#include <bits/stdc++.h>
/*#pragma GCC optimize("O3,unrool-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")*/
#define int long long

using namespace std;
vector<vector<int> > g;
vector<int> sz;

void dfs(int v, int p) {
    for (int u: g[v]) {
        if (u == p)continue;
        dfs(u, v);
        sz[v] += sz[u];
    }
    sz[v]++;
}

const int mod = 998244353;
int bp(int a, int n) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 0) {
        int b = bp(a, n / 2);
        return (b * b) % mod;
    } else {
        return (a * bp(a, n - 1)) % mod;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    int et;
    cin >> et;
    et--;
    g.resize(n);
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        p--;
        g[p].push_back(i);
        g[i].push_back(p);
    }
    sz.resize(n);
    dfs(0, 0);
    int cnt=sz[et];
    int ans=bp(2,cnt);
    for (int u: g[et]) {
        if (u<et)continue;
        ans-=bp(2,sz[u])-1;
        while (ans<0)ans+=mod;
        ans%=mod;
    }
    ans--;
    while (ans<0)ans+=mod;
    ans%=mod;
    cout <<ans;
}
    