#pragma GCC optimize("O3")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define db long double
#define MX LLONG_MAX
#define MN LLONG_MIN
#define gcd __gcd
#define lcm(a, b) (a / gcd(a, b) * b)

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int MOD = 998244353;
const int N = 1e6 + 52;

int sum[N];

int P[N + 1];
void precalc() {
    P[0] = 1;
    for (int i = 1; i <= N; i++) P[i] = (P[i - 1] * 2) % MOD;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    precalc();

    int n, k;
    cin >> n >> k;

    int x;
    cin >> x;
    x--;

    vector<int> p(n);
    for (int v = 1; v < n; v++) {
        cin >> p[v];
        p[v]--;
    }

    for (int v = n - 1; v > 0; v--) sum[p[v]] += sum[v] + 1;

    int ans = (2 * P[sum[x]] - sum[x] - 1 + MOD) % MOD;
    cout << ans;
}

/*
7 1
2
1 2 1 2 3 5
*/
