N, M, T = map(int, input().split()) A = list(map(int, input().split())) def func(time): B = [0]*N cnt = 0 for a in A: a -= 1 if B[a] < time: B[a] += 1 else: cnt += 1 if cnt == 0: return True for i in range(N): diff = time-B[i] cnt -= diff//T if cnt <= 0: return True return False left = 0 right = T*M while left+1 < right: mid = (left+right)//2 if not func(mid): left = mid else: right = mid print(right)