#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <iostream>

void memset64( void * dest, uint64_t value, uintptr_t size )
{
  uintptr_t i;
  for( i = 0; i < (size & (~7)); i+=8 )
  {
    memcpy( ((char*)dest) + i, &value, 8 );
  }  
  for( ; i < size; i++ )
  {
    ((char*)dest)[i] = ((char*)&value)[i&7];
  }  
}

int main()
{
 unsigned long long N,M;
 long long *A,*B,i,C=1,j,X=0,tX=1;
 
 scanf("%llu%llu",&N,&M);
 
 A=(long long*)calloc(N+5,sizeof(long long));
 B=(long long*)calloc(M+5,sizeof(long long));
 
 memset64(A, LLONG_MIN+5, N*sizeof(long long));
 
 for(i=1;i<=M;i++) scanf("%lld",&B[i]);

 scanf("%lld",&C);
 
 for(i=0;i<=N-M;i++)
  for(j=1;j<=M;j++)
  {
   if(A[i + j]==LLONG_MIN+5) A[i + B[j]] = i + j;
   else A[i + B[j]] = A[i + j];
  }
  
  for(i=1;i<=N;i++)
  {
   tX=1;
   if(A[i]==LLONG_MIN+5) tX*=i;
   else tX*=A[i];
   tX*=pow(C,i);
   X+=tX;
   X%=998244353;
  }
 
 printf("%lld",X);
 
 return 0;
}