#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#define ll long long
#define ld long double

using namespace std;

vector<vector<int>> g;
vector<int> sz;

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

int mod = 998244353;

int binpow(int a, int n) {
    if (n == 0) return 1;
    if (n % 2 == 1) return binpow(a, n - 1) * a % mod;
    int ans = binpow(a, n / 2);
    return ans * ans % mod;
}

void solve() {
    int n, k; cin >> n >> k;
    g.resize(n);
    int st; cin >> st; st--;
    vector<int> p(n, 0);
    for (int i = 1; i < n; i++) {
        cin >> p[i]; p[i]--;
        g[p[i]].pb(i);
    }
    sz.assign(n, 0);
    dfs(st, -1);
    int ans = binpow(2, sz[st] - 1);
    for (auto u : g[st]) {
        if (u < st) continue;
        ans -= binpow(2, sz[u]) - 1;
        ans += 2 * mod;
        ans %= mod;
    }
    ans -= 1;
    ans += binpow(2, sz[st] - 1);
    ans += 2 * mod;
    ans %= mod;
    cout << ans;
}

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