#include <iostream>
#include <stdlib.h>

using namespace std;
const int N=1e5+10;

int main()
{
    long long d=998244353,g=1,x=0,c;
    long i,j,n,m;
    cin >> n >>m;
    long* a=(long*)malloc(sizeof(long)*(n+1));
    long* b=(long*)malloc(sizeof(long)*(m+1));
    for (i=1;i<=n;i++)
        a[i]=i;
    for (i=1;i<=m;i++)
        cin >> b[i];
    cin >> c;
    for (i=0;i<=n-m;i++)
    {
        for (j=1;j<=m;j++)
            a[i+b[j]]=a[i+j];
    }
    for (i=1;i<=n;i++)
    {
        g=(g*c)%d;
        x=(x+(g*a[i])%d)%d;
    }
    cout << x;
    return 0;
}