// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef __int128 lll;

const ll inf=1e18+1,mod=998244353;
const ld eps=1e-9,pi=acos(-1);
#define all(a) a.begin(), a.end()
#define mpp make_pair
#define F first
#define S second

mt19937_64 rng(234);

ll binpow(ll n,ll k) {
    if (!k)
        return 1;
    if (k%2)
        return (binpow(n,k-1)*n)%mod;
    ll a=binpow(n,k/2);
    return (a*a)%mod;
}

vector<vector<int>>g;
vector<int>sz;
void dfs(ll v,ll pr) {
    sz[v]=1;
    for (auto i:g[v])
        if (i!=pr) {
            dfs(i,v);
            sz[v]+=sz[i];
        }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n,k;cin>>n>>k;
    ll t;cin>>t;
    g.resize(n);
    sz.resize(n);
    for (ll i=1;i<n;i++) {
        ll x;cin>>x;
        g[x-1].push_back(i);
    }
    dfs(0,-1);
    t--;
    ll an=binpow(2,sz[t]-1);
    ll a2=1;
    if (g[t].size()<2)
        a2=0;
    for (auto i:g[t])
        a2=(a2*(binpow(2,sz[i])-1))%mod;
    cout<<(an+a2)%mod;
}