#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
#define int long long
int dfs(int v, vector<vector<int> > &graph) {
    int ans = 1;
    for (int to: graph[v]) ans += dfs(to, graph);
    return ans;
}

signed main() {
    int n, k;
    cin >> n >> k;
    int x;
    cin >> x;
    vector<vector<int> > graph(n + 1);
    for (int i = 2; i <= n; i++) {
        int p;
        cin >> p;
        graph[p].push_back(i);
    }
    vector<int> nums;
    for (int to: graph[x]) nums.push_back(dfs(to, graph));
    int MOD = 998244353;
    int p = 1;
    int s = 0;
    for (int i: nums) {
        p = p * (i + 1) % MOD;
        s = (s + i) % MOD;
    }
    int ans = (2 * p + MOD + MOD - s - 1) % MOD;
    cout << ans;
}
