#include <stdio.h>

int main()
{
    long long n,m,c,x=0;
    scanf("%lld%lld",&n,&m);
    long long B[m+1],A[n+1],I[n-m];
    for (long long i=1; i<=m; ++i)
    {
        scanf("%lld",&B[i]);
    }
    for (long long i=1; i<=n; ++i)
    {
        A[i]=i;
    }
    for (long long i=0; i<=n-m; ++i)
    {
        I[i]=i;
        for (long long j=1; j<=m; j++)
        {
            A[i+B[j]]=A[i+j];
        }
    }
    scanf("%lld",&c);
    for (long long i=1; i<=n; ++i)
    {
        x+=pow(c,i)*A[i];
        x%=998244353;
    }
    printf("%lld",x);
    return 0;
}