#include <iostream>

using namespace std;
typedef long long ll;
int main()
{
    ll n,m,c;
    cin>>n>>m;
    ll b[m+1];
    for(ll i=1;i<=m;i++)
      cin>>b[i];
    cin>>c;
    ll a[n+1];
    for(ll i =1;i<=n;i++)
        a[i]=i;
    for(ll i=0;i<=n-m;i++)
        for (int j=1; j<=m; j++)
           a[i + b[j]] = a[i + j];
    ll x = 0;
    ll c1=c;
    for(ll i=1;i<=n;i++)
        {
            x+=c1*a[i];
            x=x%998244353;
            c1*=c;
        }
    cout<<x;
    return 0;
}