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

int main()
{
    long long int n, m, c, suma=0, e=1;
    scanf ("%lld %lld", &n, &m);
    int b[m], i=1, k=1, l=1, a[n], r[n], j;
    while (l<=n){
        a[l]=l;
        l++;
    }
    while (i<=m){
        scanf ("%d", &b[i]);

    i++;

    }
   for (i=0; i<=(n-m); i++){
       for (j=1; j<=m; j++){
       a[i + b[j]] = a[i + j];
    }
   }
    scanf ("%lld", &c);
    while (k<=n){
        e=e*c;
        suma=suma+e*a[k];
        k++;
    }
    printf ("%lld", suma%998244353);
    return 0;
}