#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;
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 ans=2;
    for (int u: g[et]) {
        ans*=sz[u]+1;
        ans%=mod;
    }
    ans--;
    ans-=g[et].size();
    if (ans<0)ans+=mod;
    cout <<ans;
}
