#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctime>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

// #pragma GCC optimize("Ofast")
// #pragma ivdep

using namespace std;
using ll = long long;
using ld = long double;
using lll = __int128;
using pii = pair<int, int>;
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod = 998'244'353;

void solve() {
    int n, k; cin >> n >> k;
    bool arr[n] = {};
    for (int i = 0; i < k; ++i) {
        int j; cin >> j; --j;
        arr[j] = 1;
    }
    for (int i = 0; i < n; ++i) {
        int p; cin >> p;
    }

    ll ans = 1;
    for (int i = n - 1; i >= 0; --i) {
        if (arr[i]) {
            --k;
            continue;
        }
        ans *= k + 1;
        ans %= mod;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int _ = 1;
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> _;
    #endif

    while (_--) {
        solve();
        cout << '\n';
    }

    return 0;
}
