program Krug2ZadatakE;
 var
 N,M: int64;
 i,j:integer;
  C: int64;
  X,C1: Extended;
  B: array [1..100000] of int64 ;
  A: array [1..20000000] of int64 ;
begin
     read (N,M);
     for i:=1 to M do
         read(B[i]);

     read (C);

     for i:=1 to N do
        A[i]:=i;

     for i:=0 to N-M do
         for j:=1 to M do
             A[i+B[j]]:=A[i+j];

        X:=0;

        for i:=1 to N do
         begin

          if C > 998244353 then
           C:=C  mod  998244353;

          C1:=1;
          for j:=1 to i do
          C1:=C1*C;

          X:=X+ (C1*A[i]- 998244353 *Int(C1*A[i]/998244353));


         end;

     X:=X -998244353*Int(X/998244353);
     write(X:0:0);
end.