#include <bits/stdc++.h>
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi2,popcnt,lzcnt")
using ll = long long;
using ld = long double;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
// template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//s.erase(s.find_by_order(s.order_of_key(5)));

const int MOD = 998244353;

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

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

int mul(int a, int b) {
    return a * 1ll * b % MOD;
}

int binPow(int a, int n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        return binPow(mul(a, a), n / 2);
    } else {
        return mul(a, binPow(a, n - 1));
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cout << fixed << setprecision(17);

    int n, k;
    cin >> n >> k;
    vector<int> x(k);
    vector<int> p(n);
    vector<int> used(n, 0);

    for (int i = 0; i < k; i++) {
        cin >> x[i];
        x[i]--;
        used[x[i]] = 1;
    }
    for (int i = 0; i < n - 1; i++) {
        cin >> p[i];
    }
    int cnt = 0;
    ll ans = 1;
    for (int j = 0; j < n; j++) {
        if (used[j]) {
            cnt++;
        } else {
            ans = mul(ans, cnt + 1);
        }
    }
    cout << ans;
    return 0;
}