#include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int mod = 998244353;
int pr(int u, int n) {
    if (n == 0) {
        return 1;
    }
    if (n % 2 == 0) {
        int y = pr(u, n / 2);
        return (y * y) % mod;
    }
    else {
        return (pr(u, n - 1) * u) % mod;
    }
}
vector<int> g[int(1e6) + 1];
vector<int> siz(int(1e6) + 1);
void dfs(int u) {
    siz[u] = 1;
    for (auto to : g[u]) {
        dfs(to);
        siz[u] += siz[to];
    }
}
void solve() {
    int n, k;
    cin >> n >> k;
    int x;
    cin >> x;
    for (int i = 2; i <= n; i++) {
        int lol;
        cin >> lol;
        g[lol].push_back(i);
    }
    dfs(1);
    int ans = pr(2, siz[x]) - 1;
    for (auto to : g[x]) {
        ans = (ans - pr(2, siz[to]) + 1 + mod) % mod;
    }
    cout << ans;
}
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}