{$ifdef fpc} {$mode delphi} {$endif}
{$apptype console}
{$s+,i+,r+,q+,v+,d+,l+,o-}
const
	filein = 'B.in';
	fileout = 'B.out';
	maxm = 10; maxk = 10;
var
	a,b: array[0..1 shl maxk - 1]of longint;
	cmd,cpu: longint;
	n,k,l,i,j,t: longint; flag: boolean = true;

begin
	assign(input,filein);reset(input);assign(output,fileout);rewrite(output);
	read(n,k,k,l); cmd := 0;
	for i := 1 to l do begin
		read(j); j := k - j + 1;
		cmd := cmd or (1 shl (j - 1));
	end;
	
	cpu := 0; t := 1; fillchar(a,sizeof(a),0); fillchar(b,sizeof(b),0); l := 0;
	while l < n do begin
   	inc(l);
		while cpu and cmd > 0 do begin
			cpu := (cpu shl 1) and (1 shl k - 1);
			t := t + 1;
		end;
		cpu := cpu or cmd;

		if flag then begin
			if a[cpu] = 0 then begin
				a[cpu] := t;
				b[cpu] := l;
			end else begin
				i := t - a[cpu];
				j := l - b[cpu];
				t := t + i * ((n - l) div j);
				n := l + (n - l) mod j;
				flag := false;
			end;
		end;
	end;

	writeln(t + k - 1);
	close(output);
end.