#include <bits/stdc++.h>

#define int long long

using namespace std;

vector<bool> vis;

const int MOD = 998244353;

int dfs(vector<vector<int>> &g, int v, int p) {
    int sz = 1;
    for (auto u : g[v]) {
        if (u == p) continue;
        sz += dfs(g, u, v);
    }
    return sz;
}

int mul(int a, int b) {
    return (long long)a * b % MOD;
}

int bin_pow(int a, int n) {
    if (n == 0) return 1;
    if (n == 1) return a;
    if (n % 2 == 0) {
        int ax = bin_pow(a, n / 2);
        return mul(ax, ax);
    } else {
        return mul(a, bin_pow(a, n - 1));
    }
}

int add(int a, int b) {
    if (a + b >= MOD) return a - MOD + b;
    return a + b;
}

int sub(int a, int b) {
    if (a + b < 0) return a + MOD - b;
    return a - b;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int x;
    cin >> x;
    x--;
    vector<vector<int>> g(n);
    vector<int> p(n);
    for (int i = 1; i < n; i++) {
        int v; cin >> v; v--;
        p[i] = v;
        g[v].push_back(i);
        g[i].push_back(v);
    }
    int ans1 = 1, ans2 = 0;
    int sum = 1;
    for (auto u : g[x]) {
        if (u == p[x]) continue;
        int sz = dfs(g, u, x);
        int cur = bin_pow(2, sz);
        ans1 = mul(ans1, cur);
        cur = sub(cur, 1);
        ans2 = add(ans2, mul(cur, sum));
        sum = mul(sum, cur);
    }
    cout << add(ans1, ans2) << endl;
    return 0;
}
