#pragma gcc optimize("Ofast")
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <random>
#include <bitset>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;
#define int long long
using ll = long long;
using ld = long double;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...)
#endif
vector<vector<int>> g;
vector<int> sz;

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

const int MOD = 998244353;

int sum(int a, int b) {
    if (a + b < MOD) return a + b;
    return a + b - MOD;
}

int sub(int a, int b) {
    if (a - b >= 0) return a - b;
    return a - b + MOD;
}

int mult(int a, int b) {
    return a * b % MOD;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, k;
    cin >> n >> k;
    int need;
    cin >> need;
    need--;
    g = vector<vector<int>> (n);
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p;
        g[p - 1].push_back(i);
    }
    sz = vector<int> (n);
    dfs(0);
    vector<int> st(n + 1);
    st[0] = 1;
    for (int i = 1; i <= n; i++) {
        st[i] = mult(st[i - 1], 2);
    }
    int total = st[sz[need]];
    for (int u : g[need]) {
        total = sub(total, sub(st[sz[u]], 1));
    }
    cout << sub(total, 1);
}
