var
	a : array[ 0..2000 , 0..2000 ] of byte;
	d : array[ 1..10000 ] of longint;
	iskl : array[ 1..10 ] of byte;
	min , cycle , tmp , i , L , N , M , K : longint;
	max : int64;

procedure rec( x , m : longint );
var
	i , j : longint;
	ok : boolean;

begin
 if m <= cycle + 1 then
  begin
   j := x - 1;
   repeat
    inc( j );
    ok := true;
    for i := j to j + k - 1 do
     if ( a[ m - 1 , i ] = 1 ) and ( iskl[ i - j + 1 ] = 1 ) then
      begin
       ok := false;
       break;
      end;
   until ok;
   d[ m ] := j + k - 1;
   for i := j to j + k - 1 do
    if ( a[ m - 1 , i ] = 1 ) or ( iskl[ i - j + 1 ] = 1 ) then
     a[ m , i ] := 1;
   rec( j + 1 , m + 1 );
  end;
end;

begin
 assign( input , 'B.in' );
  reset( input );
 assign( output , 'B.out' );
  rewrite( output );
 readln( N , M , K );
 readln( L );
 for i := 1 to L do
  begin
   read( tmp );
   iskl[ tmp ] := 1;
  end;
 cycle := 1 shl L;
 rec( 1 , 1 );
 min := 0;
 for i := d[ cycle ] - k + 1 to d[ cycle ] do
  begin
   if a[ cycle + 1 , i ] = 1 then
    break;
   inc( min );
  end;
 max := ( d[ cycle ] + min - k );
 max := max * ( ( N div cycle ) - 1 );
 max := max + d[ cycle ];
 if ( N div cycle = 0 ) then
  begin
   max := d[ N ];
  end
 else if ( N mod cycle > 0 ) then
  begin
   max := max + d[ N mod cycle ] + min - k;
  end;
 writeln( max );
 close( output );
end.