# 自作ライブラリ # https://github.com/takumi-okamoto/competitive-programming-public/tree/main/mylib import sys from collections import Counter import heapq # sys.setrecursionlimit(10**8) def debug(*args): print(*args, file=sys.stderr) def main(): n, m, t = map(int, input().split()) a = list(map(int, input().split())) c = Counter(a) times = [None] + [0] * (n + 1) que = [] for i in range(1, n + 1): if c[i] > 0: que.append((1, i, i)) else: que.append((t, i, n + 1)) heapq.heapify(que) for _ in range(m): t_, idx, target = heapq.heappop(que) if idx == target: times[idx] = t_ c[idx] -= 1 if c[idx] > 0: heapq.heappush(que, (t_ + 1, idx, target)) else: heapq.heappush(que, (t_ + t, idx, n + 1)) else: times[idx] = t_ heapq.heappush(que, (t_ + t, idx, n + 1)) print(max(times[1:])) if __name__ == "__main__": main()