from time import time time0=time() from random import randint,random e=2.718281828 N,M,K=map(int,input().split()) A=list(map(int,input().split())) A.append(0) ANS=[0]*K score=0 MAX=0 while time()-time0<1.8: x,y=randint(0,K-1),randint(0,N) before=ANS[x] plus=y-before if plus>0 and score+plus<=M: ANS[x]=y score+=plus MAX=max(MAX,score) elif score+plus<=M: mu=e**(plus*2/time()-time0) if mu>0: ANS[x]=y score+=plus MAX=max(MAX,score) print(MAX)