#include <stdio.h>
#include <stdlib.h>
#include <math.h>

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