#include<stdio.h>
#include <iostream>

using namespace std;
int a[500003],b[100003];
int main()
{
    long long x=0;
    int i,j,n,m,c,pomc;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        a[i]=i;
    for(i=1;i<=m;i++)
        scanf("%d",&b[i]);
    for(i=0;i<=n-m;i++)
        for(j=1;j<=m;j++)
            a[i+b[j]]=a[i+j];
    scanf("%d",&c);
    pomc=c;
    for(i=1;i<=n;i++)
    {
        x=x+(long long)c*(long long)a[i];
        c=c*pomc;
    }
    printf("%lld",x%998244353);
    //for(i=1;i<=n;i++)
     //   printf("%d ",a[i]);
    //cout << "Hello world!" << endl;
    return 0;
}