#include<bits/stdc++.h>
using namespace std;
// #pragma GCC optimize("Ofast")
using ll = long long;
using ld = long double;
using vl = __int128_t;
using ull = unsigned long long;
#define pb emplace_back
#define all(x) (x).begin(), (x).end()
constexpr int mod = 998244353;
int x;
vector<vector<int>> g;
vector<int> sz;
vector<ll> ans;
ll fpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}
void dfs(int v, int p) {
    sz[v] = 1;
    for (int u : g[v]) {
        if (u == p) continue;
        dfs(u, v);
        sz[v] += sz[u];
    }
    ans[v] = fpow(2, sz[v] - 1);
    ll pr = 0;
    int cnt = 0;
    for (int u : g[v]) {
        if (u == p) continue;
        cnt++;
        if (pr == 0) pr = 1;
        pr = pr * fpow(2, sz[u]) % mod;
        ans[v] = (ans[v] - fpow(2, sz[u]) + mod) % mod;
    }
    ans[v] = (ans[v] + pr + cnt - 1 + mod) % mod;
}
void solve() {
    int n, k;
    cin >> n >> k;
    g.resize(n);
    sz.resize(n);
    ans.resize(n);
    cin >> x;
    for (int i = 1; i < n; ++i) {
        int p;
        cin >> p;
        p--;
        g[p].pb(i);
        g[i].pb(p);
    }
    dfs(0, -1);
    cout << ans[x - 1];
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
