#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    long n,m;
    cin >> n >> m;
    long b[100000];
    vector <long> a;

    for (int i = 1; i <= m; ++i)
        cin >> b[i];

    long c;
    cin >> c;

    for (int i = 1; i <= n; ++i)
        a.push_back(i);

    long d = n-m;

    for (int i = 0; i <= d; ++i)
        for (int j = 1; j<=m; ++j)
        a[i + b[j]] = a[i+j];

    long long x(0);
    for (int i = 1; i <= n; ++i)
        x = (x + static_cast<long long>(pow(c,i))*a[i]) % 998244353;

    cout << x;
    return 0;
}