program peti;
var i,j,n,m,c,x: longint;
a: array[1..20000000] of int64;
b: array[1..100000] of int64;
function STEPEN(h:longint; g:longint): longint;
var f,d: longint;
begin
        d:=h;
        for f:=2 to g do
        h:=h*d;
        STEPEN:=h
end;
begin
        read(n,m);
        writeln;
        x:=0;
        for i:=1 to n do
         a[i]:=i;
        for i:=1 to m do
         read(b[i]);
        writeln;
        read(c);
        for i:=0 to n-m do
                for j:=1 to m do
                        begin
                        a[i+b[j]]:=a[i+j];
                        end;
        writeln;
        for i:=1 to n do
        x:=x+(STEPEN(c,i)*a[i]);
        if x>=998244353 then
        write('998244352')
        else write(x);
end.