#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#include<random>
#include<chrono> 
using namespace std;
using ll = long long;
using ld = long double;

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx")

#define int long long
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 998244353;

vector<vector<int>> g;
vector<int> sz;

void dfs(int v) {
    sz[v] = 1;
    for (auto to : g[v]) {
        dfs(to);
        sz[v] += sz[to];
    }
}

int goy(int x) {
    return (x % mod + mod) % mod; 
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    if (k == 1) {
        vector<int> bin(n + 1);
        bin[0] = 1;
        for (int i = 1; i <= n; ++i) {
            bin[i] = bin[i - 1] * 2 % mod;
        }
        int ver;
        cin >> ver;
        ver--;
        g.resize(n);
        sz.resize(n);
        for (int i = 1; i < n; ++i) {
            int p;
            cin >> p;
            --p;
            g[p].push_back(i);
        }
        dfs(0);
        int ans = goy(bin[sz[ver]] - 1);
        for (auto to : g[ver]) {
            ans -= bin[sz[to]] - 1;
            goy(ans);
        }
        cout << ans << '\n';
    }
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}
