#include <bits/stdc++.h>

// #define int long long

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

const int maxn = 1e6 + 10, mod = 998244353;

vector<int> g[maxn];
int fact[maxn], rfact[maxn];
int sz[maxn];

int bpow(int x, int y) {
    if (y == 0) return 1;
    if (y % 2 == 1) return (ll)x * bpow(x, y - 1) % mod;
    int pw = bpow(x, y >> 1);
    return (ll)pw * pw % mod;
}

void dfs(int vi) {
    sz[vi] = 1;
    for (auto to : g[vi]) {
        dfs(to);
        sz[vi] += sz[to];
    }
}

int C(int n, int k) {
    return (ll)fact[n] * rfact[k] % mod * rfact[n - k] % mod;
}

void solve() {
    int n, k;
    cin >> n >> k;
    for (int i = 2; i <= n; i++) {
        int p; cin >> p;
        g[p].push_back(i);
    }
    int x; cin >> x;
    dfs(x);
    int ans = bpow(2, sz[x] - 1);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = (ll)fact[i - 1] * i % mod;
    rfact[n] = bpow(fact[n], mod - 2);
    for (int i = n - 1; i >= 0; i--) {
        rfact[i] = (ll)rfact[i + 1] * (i + 1) % mod;
    }
    for (int i = 2; i <= sz[x]; i++) {
        ans += C(sz[x] - 1, i);
        if (ans >= mod) ans -= mod;
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int test = 1;
    // cin >> test;
    while (test--) {
        solve();
    }
}