//#include<cstdio>
//#include<iostream>
//using namespace std;

#include<stdio.h>
#include<string.h>

struct{
	char flag; 
	int time, i;
	}h[1<<11];

unsigned long conv, comm;
int n, m, k, l, i, j, a, pc;
__int64 time;
char b;

int main()
{
	freopen("B.in", "r", stdin);
	freopen("B.out", "w", stdout);
	conv=0;
	comm=0;
	scanf("%d%d%d",&n,&m,&k);
	scanf("%d",&l);
	for(i=0;i<l;i++){
		scanf("%d",&a);
		comm|=1<<(a-1);
		}
	time = 0;
	b=(n>1000010);
//	b=1;
	if (b)memset(h,0,sizeof(h));
	for(i=0;i<n;i++){
		if(b){
			if(h[conv].flag){
				pc=(n-1000-i)/(i-h[conv].i);
				n-=pc*(i-h[conv].i);
				time+=pc*(time-h[conv].time);
				b=0;
				}
			else{
				h[conv].flag=1;
			h[conv].i=i;
				h[conv].time=time;
				}
			}
		while(comm & conv){
			conv >>= 1;
			time++;
			}
		conv|=comm;
		
		}
	printf("%I64d\n",time+k);
	
	
	return 0;
}