uses math;
Var a:array [0..1000000] of boolean;
    g : array [0..10] of boolean;
    len , per , st , i , j , k , l , m , n , x  , v , y , z , kol , sicl  : longint;
    ans : int64;
    steck , pred , kmp , b : array [0..1000000] of longint;
function check: boolean;
Var t : boolean; j : longint;
begin
   for j := 1 to k do
      if a[kol+j-1]=true then 
         if g[j]=true then break;
   if (a[kol+j-1]=true) and (g[j]=true) then t := true else t := false;
   check := t;
end;
begin
   assign(input,'B.in'); reset(input);
   assign(output,'B.out'); rewrite(output);
   readln(n,m,k);
   readln(l);
   fillchar(a,sizeof(a),false);
   fillchar(g,sizeof(g),false);
   for i := 1 to l do
      begin
         read(x);
         g[x] := true;
      end;
   st := m;
   x := min(n,500*m*k);
   kol := 0;   
   steck[0] := 1;
   v := -1;
   for i := 1 to x do begin
      inc(kol);
      inc(st);
      if st > m then st := st mod m;
      while check=true do inc(kol);
      for j := 1 to k do
         a[kol+j-1] := g[j] or (a[kol+j-1]);
      b[i] := kol;
      if st=1 then begin
         inc(v);
         steck[v] := i;
         pred[v] := kol - b[steck[v-1]];
      end;
   end;
   

   if x = n then begin writeln(b[n]+k-1); close(output); halt(0); end;
 
   y := 0;
   kmp[1] := 0;
   for i := 2 to v do begin
      while (pred[y+1] <> pred[i]) and (y > 0) do y := kmp[y];
      if pred[y+1] = pred[i] then inc(y);
      kmp[i] := y;
   end;
   
   for j := v downto 2 do
      if j mod (j-kmp[j]) = 0 then break;
   ans := 0;

   y := steck[j - kmp[j]]-1;
   len := b[y]+k-1;
   per := max(0,b[y]+k - b[y+1]);
   ans := (n div y)*(len-per);
   if n mod y = 0 then inc(ans,per) else inc(ans,b[n mod y]+k-1);
   writeln(ans);
   close(output);
end.    