#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using ll = long long;
using ld = long double;

#define int ll

const int MOD = 998'244'353;

int fpow(int v, int st) {
    if (st == 0) return 1;
    if (st == 1) return v;

    int res = fpow(v, st / 2);
    res *= res;
    res %= MOD;

    if (st % 2 == 1) {
        res *= v;
        res %= MOD;
    }
    return res;
}


vector<vector<int>> graph;
vector<int> sz;

void dfs(int start) {
    sz[start] = 1;

    for (auto child : graph[start]){
        dfs(child);
        sz[start] += sz[child];
    }
}

signed main() {
    int n, k;
    cin >> n >> k;

    int u;
    cin >> u;
    u--;

    graph.resize(n);
    sz.resize(n);

    for (int i = 1; i < n; ++i) {
        int pi;
        cin >> pi;
        pi--;
        graph[pi].push_back(i);
    }

    dfs(0);

    int res = fpow(2, sz[u] - 1);
    int addx = 0;
    for (auto child : graph[u]) {
        int now = fpow(2, sz[child]) - 1 + MOD;
        now *= fpow(2, sz[u] - sz[child] - 1) - 1 + MOD;
        now %= MOD;

        addx += now;
        addx %= MOD;
    }
    addx *= fpow(graph[u].size(), MOD - 2);
    addx %= MOD;
    res += addx;
    res %= MOD;

    cout << res;
}