// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("O3,unroll-loops")
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;
using ld = long double;
ll MOD = 998244353;
vector<vector<ll>> tr;
vector<ll> sz;
ll binpow(ll x, ll p){
    if (p == 0){
        return 1;
    }
    if (p&1){
        return (x*binpow(x, p-1))%MOD;
    }
    ll a = binpow(x, p/2);
    return (a*a)%MOD;
}
ll dfs(ll x){
    for (auto&e:tr[x]){
        dfs(e);
        sz[x] += sz[e];
    }
    ll ans = binpow(2, sz[x]-1);
    ll w = sz[x]-1;
    for (auto&e:tr[x]){
        w -= sz[e];
        ans += ((binpow(2, sz[e])-1)*(binpow(2, w)-1))%MOD;
        ans %= MOD;
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, k;
    cin>>n>>k;
    ll x;
    cin>>x;x--;
    tr.resize(n);
    for (ll i = 1; i<n; i++){
        ll p;
        cin>>p;p--;
        tr[p].push_back(i);
    }
    sz.resize(n, 1);
    cout<<dfs(x)<<endl;
    return 0;
}