program project1;

const broj = 998244353;

type longintarray = array[1..20000000] of longint;

var c, i, j, m, n, x: longint;
  a, b: longintarray;

function pow(apow,bpow: longint):longint;
var ip: longint;
begin
  pow:=apow;
  for ip:=2 to bpow do pow:=pow*apow;
end;

function res(ares, ires, cres: longint):longint;
begin
  res:=ares*pow(cres,ires);
end;

begin
  read(n);
  readln(m);
  for i:=1 to m do read(b[i]);
  readln(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 x:=(x+res(a[i],i,c)) mod broj;
  writeln(x);
end.