#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <limits>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

const int INF = 1e9 + 7;
const ll LL_INF = 4e18;

const int MAXN = 1e6 + 11;
const ll MOD = 998244353;
vector<vector<int>> gr(MAXN);
vector<int> qs, sz;

int n, nQ;
vector<ll> pows;

ll bin_pow(ll a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return (a * bin_pow(a, p - 1)) % MOD;
    else {
        ll temp = bin_pow(a, p / 2);
        return (temp * temp) % MOD;
    }
}

ll inv(ll a) {
    return bin_pow(a, MOD - 2);
}

void DFS(int v) {
    sz[v] = 1;
    for (const int u : gr[v]) {
        DFS(u);
        sz[v] += sz[u];
    }
}

void solve_k1() {
    cin >> n >> nQ;

    pows.resize(n + 1);
    qs.resize(n);
    sz.resize(n);

    pows[0] = 1;
    for (int i = 1; i <= n; ++i) {
        pows[i] = (pows[i - 1] * 2) % MOD;
    }

    int c;
    cin >> c;
    --c;

    int par;
    for (int i = 1; i < n; ++i) {
        cin >> par;
        par--;
        gr[par].push_back(i);
    }

    DFS(0);

    ll ans = 0;
    ans = pows[sz[c]];

    //cout << ans << '\n';

    ll prod = 1;
    for (const int u : gr[c]) {
        ll to_mult = (pows[sz[u]] - 1 + MOD) % MOD;
        prod = (prod * to_mult) % MOD;
    }

    for (const int u : gr[c]) {
        ll to_mult = (pows[sz[u]] - 1 + MOD) % MOD;

        // cout << u << ' ' << to_mult << '\n';

        prod = (prod * inv(to_mult)) % MOD;
        // cout << prod << '\n';
        ans = (ans - prod + MOD) % MOD;
        prod = (prod * to_mult) % MOD;
    }
    ans = (ans - 1 + MOD) % MOD;

    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    solve_k1();
    return 0;
}