#include "bits/stdc++.h" using namespace std; #define rep(i,s,t) for (auto i=s; i != t; ++i) #define rrep(i,s,t) for (auto i=t; i-- != s;) typedef long long ll; constexpr auto inf = numeric_limits::max() / 2; constexpr bool chmin(auto &a, auto const &x) { return a > x ? a = x, true : false; } constexpr bool chmax(auto &a, auto const &x) { return a < x ? a = x, true : false; } // constexpr auto ascii_lowercase = "qwertyuiopasdfghjklzxcvbnm"sv; int main() { int N, M, T; cin >> N >> M >> T; vector Cnt(N); while (M--) { int a; cin >> a; --a; Cnt[a] += 1; } auto f = [&](ll const t) -> bool { ll use=0; for (int const c : Cnt) { if (c <= t) use -= (t - c) / T; else use += c - t; } return use <= 0; }; ll ok=inf, ng=0; while (ok - ng > 1) { ll const m = midpoint(ok, ng); if (f(m)) ok = m; else ng = m; } cout << ok << endl; }