Problem: There used to be unrest in the Galactic Senate. Several thousand solar systems had declared their intentions to leave the Republic. But fear not! Master Heidi was able to successfully select the Jedi Knights that have restored peace in the galaxy. However, she knows that evil never sleeps and a time may come when she will need to pick another group of Jedi Knights. She wants to be sure she has enough options to do so.

There are n Jedi Knights, each of them with a lightsaber of one of m colors. Given a number k, compute the number of differently colored collections of k lightsabers that some k Jedi Knights might have. Jedi Knights with lightsabers of the same color are indistinguishable (it's not the person, it's the lightsaber color that matters!), and their order does not matter; that is, we consider two collections of Jedi Knights to be different if and only if their vectors of counts of lightsabers of each color (like what you were given in the easy and the medium versions) are different. We count all subsets, not only contiguous subsegments of the input sequence. Output the answer modulo 1009.

Input

The first line of the input contains n (1 ≤ n ≤ 2·105), m (1 ≤ m ≤ n) and k (1 ≤ k ≤ n). The second line contains n integers in the range {1, 2, ..., m} representing colors of the lightsabers of subsequent Jedi Knights.

Output

Output one number: the number of differently colored collections of k lightsabers modulo 1009.

Example

Input

4 3 2
1 2 3 2


Output

4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 8e5 + 10, M = 1 << 15;
const double Pi = acos(-1.0);
struct Complex {
  double x, y;
  Complex(double X = 0, double Y = 0) {
    x = X;
    y = Y;
  }
} W[N];
Complex operator+(Complex a, Complex b) {
  return Complex(a.x + b.x, a.y + b.y);
}
Complex operator-(Complex a, Complex b) {
  return Complex(a.x - b.x, a.y - b.y);
}
Complex operator*(Complex a, Complex b) {
  return Complex(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
int rev[N], mod = 1009;
inline void calrev(int limit) {
  for (int i = 0; i < limit; i++)
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) ? limit >> 1 : 0);
  for (int i = 1; i < limit; i <<= 1)
    for (int k = 0; k < i; k++)
      W[limit / i * k] = Complex(cos(k * Pi / i), sin(k * Pi / i));
}
inline void FFT(Complex *A, int limit, int type) {
  for (int i = 0; i < limit; i++)
    if (i < rev[i]) swap(A[i], A[rev[i]]);
  for (int mid = 1; mid < limit; mid <<= 1)
    for (int j = 0; j < limit; j += (mid << 1))
      for (int k = 0; k < mid; k++) {
        Complex w = Complex(W[limit / mid * k].x, W[limit / mid * k].y * type);
        Complex x = A[j + k], y = w * A[j + mid + k];
        A[j + k] = x + y;
        A[j + mid + k] = x - y;
      }
  if (type == -1)
    for (int i = 0; i < limit; i++) A[i].x /= limit * 1.0, A[i].y /= limit;
}
Complex Q[N], E[N], d[N], e[N];
inline void MTT(int *a, int n, int *b, int m, int *c) {
  int limit = 1;
  while (limit < 2 * (n + m)) limit <<= 1;
  calrev(limit);
  for (int i = 0; i < n; i++) Q[i] = Complex(a[i] & 0x7fff, a[i] >> 15);
  for (int i = n; i < limit; i++) Q[i] = Complex(0, 0);
  for (int i = 0; i < m; i++) E[i] = Complex(b[i] & 0x7fff, b[i] >> 15);
  for (int i = m; i < limit; i++) E[i] = Complex(0, 0);
  FFT(Q, limit, 1);
  FFT(E, limit, 1);
  for (int i = 0; i < limit; i++) {
    int t = (limit - i) & (limit - 1);
    d[i] = Complex(0.5 * (Q[i].x + Q[t].x), 0.5 * (Q[i].y - Q[t].y)) * E[i];
    e[i] = Complex(0.5 * (Q[i].y + Q[t].y), 0.5 * (Q[t].x - Q[i].x)) * E[i];
  }
  FFT(d, limit, -1);
  FFT(e, limit, -1);
  for (int i = 0; i < limit; i++) {
    long long X = (long long)(d[i].x + 0.5), Y = (long long)(d[i].y + 0.5),
              Z = (long long)(e[i].x + 0.5), U = (long long)(e[i].y + 0.5);
    c[i] = ((X % mod) + (((Y + Z) % mod) << 15) + ((U % mod) << 30)) % mod;
  }
  for (int i = n + m - 1; i < limit; i++) c[i] = 0;
}
int A[N], B[N], C[N];
inline vector<int> merge(vector<int> &a, vector<int> &b) {
  vector<int> c;
  int n = a.size(), m = b.size();
  for (int i = 0; i < n; i++) A[i] = a[i];
  for (int i = 0; i < m; i++) B[i] = b[i];
  MTT(A, n, B, m, C);
  c.resize(n + m - 1);
  for (int i = 0; i < n + m - 1; i++) c[i] = C[i];
  return c;
}
struct rec {
  int len;
  vector<int> v;
  friend inline bool operator<(const rec &a, const rec &b) {
    return a.len > b.len;
  }
};
priority_queue<rec> q;
int n, m, k, cnt[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 1, x; i <= n; i++) cin >> x, cnt[x]++;
  for (int i = 1; i <= m; i++) {
    vector<int> v;
    v.clear();
    if (!cnt[i]) continue;
    for (int j = 0; j <= cnt[i]; j++) v.push_back(1);
    q.push(rec{(int)v.size(), v});
  }
  while (q.size() > 1) {
    vector<int> x = q.top().v;
    q.pop();
    vector<int> y = q.top().v;
    q.pop();
    vector<int> z = merge(x, y);
    q.push(rec{(int)z.size(), z});
  }
  vector<int> res = q.top().v;
  cout << res[k] << endl;
  return 0;
}