#include <iostream>
#include <bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;a++)
#define ll long long
const int MAX=2*1e5+2,MOD=998244353;
using namespace std;

int n,m,c,a[MAX],b[MAX];
ll rez=0,poww[MAX];

int main()
{
    cin>>n>>m;
    For(i,1,m)
    scanf("%i",&b[i]);
    poww[0]=1;

    cin>>c;
    For(i,1,n)
    poww[i]=(poww[i-1]*c)%MOD;
    if (n<=1000)
    {
        For(i,1,n) a[i]=i;
        For(i,0,n-m)
        For(j,1,m)
        a[i+b[j]]=a[i+j];
    For(i,1,n)
    rez=(rez+((ll)a[i]*poww[i])%MOD)%MOD;
    while (rez>=MOD)
        rez-=MOD;
    while (rez<0) rez+=MOD;
    cout<<rez;
    }



    return 0;
}