#include using namespace std; using ll = long long; using ld = long double; using pll = pair; using vl = vector; template using vec = vector; template using vv = vec>; template using vvv = vv>; template using minpq = priority_queue, greater>; #define all(a) (a).begin(),(a).end() #define rep(i, n) for (ll i = 0; i < (n); ++i) #define reps(i, l, r) for(ll i = (l); i < (r); ++i) #define rrep(i, l, r) for(ll i = (r)-1; i >= (l); --i) #define sz(x) (ll) (x).size() template bool chmax(T &a, const T& b) { return a < b ? a = b, true : false; } template bool chmin(T &a, const T& b) { return a > b ? a = b, true : false; } #define EPS (1e-10) #define equals(a, b) (fabs((a) - (b)) < EPS) class Point { public: ld x; ld y; Point(ld _x = 0, ld _y = 0) : x(_x), y(_y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(ld a) { return Point(a * x, a * y); } Point operator/(ld a) { return Point(x / a, y / a); } ld abs() { return sqrt(norm()); } ld norm() { return x * x + y * y; } bool operator<(const Point& p) const { return !equals(x, p.x) ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.x) < (1e-10) && fabs(y - p.y) < (1e-10); } }; typedef Point Vector; struct Segment { Point A; Point B; }; typedef Segment Line; class Circle { public: Point C; ld r; Circle(Point C = Point(), ld r = 0.0) : C(C), r(r) {} }; typedef vector Polygon; struct Edge { ll from, to, cost; Edge (ll from, ll to, ll cost = 1ll) : from(from), to(to), cost(cost) {} }; struct Graph { vector> G; Graph() = default; explicit Graph(ll N) : G(N) {} size_t size() const { return G.size(); } void add(ll from, ll to, ll cost = 1ll, bool direct = 0) { G[from].emplace_back(from, to, cost); if (!direct) G[to].emplace_back(to, from, cost); } vector &operator[](const int &k) { return G[k]; } }; using Edges = vector; void solve(){ ll N, M, T; cin >> N >> M >> T; vl a(M); rep(i, M) cin >> a[i]; vl b(N, 0); rep(i, M){ b[a[i]-1]++; } sort(all(b)); reverse(all(b)); ll ok = M, ng = 0; while(ok - ng > 1){ ll mid = (ok + ng) / 2; ll rot = 0; rep(i, N){ if(b[i] > mid) rot += (b[i] - mid); else{ rot -= (mid - b[i]) / T; } } if(rot <= 0) ok = mid; else ng = mid; } cout << ok << endl; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); int t = 1; // cin >> t; while(t--){ solve(); } }