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;
class cd {
  double a, b;

 public:
  cd() { a = b = 0; }
  cd(long long _a) { a = _a, b = 0; }
  cd(double _a, double _b) { a = _a, b = _b; }
  double real() { return a; }
  double imag() { return b; }
  void operator+=(cd& X) { a += X.a, b += X.b; }
  void operator*=(cd& X) {
    double _a = a, _b = b;
    a = _a * X.a - _b * X.b, b = _b * X.a + _a * X.b;
  }
  void operator/=(long long n) { a /= (double)n, b /= (double)n; }
  cd operator*(cd& X) { return cd(a * X.a - b * X.b, b * X.a + a * X.b); }
  cd operator+(cd& X) { return cd(a + X.a, b + X.b); }
  cd operator-(cd& X) { return cd(a - X.a, b - X.b); }
};
const double PI = acos(-1.0);
long long rev[800010], cur_len = 0;
cd W[800010];
void reverse(long long n) {
  for (long long i = 0; i < n; ++i) {
    rev[i] = rev[i >> 1] >> 1;
    if (i & 1) rev[i] ^= (n >> 1);
  }
}
void fft(vector<cd>& A, bool inv = 0) {
  long long n = A.size();
  if (cur_len != n) reverse(n), cur_len = n;
  for (long long i = 0; i < n; ++i) {
    if (i < rev[i]) swap(A[i], A[rev[i]]);
  }
  for (long long s = 1; s < n; s <<= 1) {
    double x = (inv ? -1 : 1) * PI / s;
    cd w(cos(x), sin(x));
    W[0] = cd(1, 0);
    for (long long i = 1; i < s; ++i) W[i] = W[i - 1] * w;
    for (long long i = 0; i < n; i += 2 * s) {
      for (long long j = 0; j < s; ++j) {
        cd u = A[i + j], v = A[i + j + s] * W[j];
        A[i + j] = u + v, A[i + j + s] = u - v;
      }
    }
  }
  if (inv)
    for (long long i = 0; i < n; ++i) A[i] /= (n << 1);
}
vector<long long> mul(vector<long long>& a, vector<long long>& b) {
  long long n = 1;
  while (n < max((long long)(a).size(), (long long)(b).size())) n <<= 1;
  n <<= 1;
  vector<cd> A(n);
  for (long long i = 0; i < n; ++i) {
    double x = 0, y = 0;
    if (i < (long long)(a).size()) x = a[i];
    if (i < (long long)(b).size()) y = b[i];
    A[i] = cd(x, y);
  }
  fft(A);
  for (long long i = 0; i < n; ++i) A[i] = A[i] * A[i];
  fft(A, 1);
  long long k = (long long)(a).size() + (long long)(b).size();
  vector<long long> ans(k);
  for (long long i = 0; i < k; ++i)
    ans[i] = (long long)(A[i].imag() + 0.5) % (long long)(1009);
  return ans;
}
vector<long long> solve(long long lo, long long hi, vector<long long>& cnt) {
  if (lo == hi) {
    vector<long long> now;
    for (long long i = 0; i < cnt[lo] + 1; ++i) now.push_back(1);
    return now;
  }
  long long mid = (lo + hi) >> 1;
  vector<long long> L = solve(lo, mid, cnt), R = solve(mid + 1, hi, cnt);
  return mul(L, R);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> f(n + 1, 0);
  for (long long i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    f[x]++;
  }
  vector<long long> cnt;
  for (long long x : f)
    if (x) cnt.push_back(x);
  cout << solve(0, (long long)(cnt).size() - 1, cnt)[k];
  return 0;
}