def bsearch(low: int, high: int, pred, is_complement=False) -> int: def test(x: int) -> bool: return not pred(x) if is_complement else pred(x) assert test(low) lo = low hi = high res = low while lo <= hi: m = (lo + hi) // 2 if test(m): res = max(res, m) lo = m + 1 else: hi = m - 1 return res + 1 if is_complement else res INF = 1 << 60 N, M, T = map(int, input().split()) A = list(map(lambda x: int(x)-1, input().split())) def can(t: int) -> bool: xs = [0] * N cnt = 0 for a in A: if xs[a] < t: xs[a] += 1 else: cnt += 1 d = 0 for i in range(N): d += (t - xs[i]) // T return cnt <= d res = bsearch(0, INF, can, is_complement=True) print(res)