#include <bits/stdc++.h>
#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

#ifndef ABOBA
#pragma GCC traget("avx2")
#pragma GCC optimize("O3")
#endif

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using uint = unsigned int;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

constexpr ll inf = 1e18, mod = 998244353;

int main() {
    ll n, k;
    cin >> n >> k;
    ll x, ans = 2;
    cin >> x;
    vector<ll> p(n), can(n);
    can[--x] = 1;
    for (ll i = 1; i < n; ++i) {
        cin >> p[i];
        if (can[p[i] - 1]) {
            ans = ans * 2 % mod, can[i] = 1;
        }
    }
    cout << ((ans - n) % mod + mod) % mod;
}

void solve() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll tt = 1;
    //cin >> tt;
    while (tt--) solve();
}
