#include <bits/stdc++.h>

using namespace std;

int mod = 998244353;

long long fast_as_fuck(long long n, long long s)
{
    long long rez = 1;
    while(s > 0)
    {
        if(s & 1)
        {
            rez = (rez * n)%mod;
        }

        n = (n*n)%mod;
        s = s >> 1;
    }

    return rez;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    long long a[n+1];
    int b[m+1];
    for(int i = 1; i <= m; i++)
    {
        cin >> b[i];
    }
    long long c;
    cin >> c;

    for(int i = 0; i <= n; i++)
    {
        a[i] = i;
    }

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

    long long x = 0;
    for(int i = 1; i <= n; i++)
    {
        x += (fast_as_fuck(c, i)*a[i])%mod;
        x %= mod;
    }


    cout << x;
}