#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long int n, m, c, x;
    cin >> n >> m;

    vector<int> b, a;

    b.push_back(0);
    a.push_back(0);

    for (int i = 0; i < m; i++)
    {
        int s;
        cin >> s;

        b.push_back(s);
    }

    cin >> c;
    x = c;

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

    for (int i = 0; i <= n-m; i++)
    {
         for (int j = 1; j <= m; j++)
        {
            a[i + b[j]] = a[i + j];
        }
    }

    long long int rez = 0;

    for (int i = 1; i <= n; i++)
    {
        rez += (x%998244353)*(a[i]%998244353);
        x *= c;
    }

    cout << rez << endl;

    return 0;
}