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 long long mod = 1009;
const long long MAXN = 1000005;
const double pi = acos(-1);
long long rev[4 * MAXN];
void fft(complex<double> *a, long long n, long long opt) {
  long long bit = 0;
  while ((1 << bit) < n) bit++;
  for (long long i = 0; i < n; i++) {
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (bit - 1));
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  }
  for (long long mid = 1; mid < n; mid <<= 1) {
    complex<double> temp(cos(pi / mid), opt * sin(pi / mid));
    for (long long i = 0; i < n; i += mid + mid) {
      complex<double> omega(1, 0);
      for (long long j = 0; j < mid; j++, omega *= temp) {
        complex<double> x = a[i + j], y = omega * a[i + j + mid];
        a[i + j] = x + y, a[i + j + mid] = x - y;
      }
    }
  }
  if (opt == -1)
    for (long long i = 0; i < n; i++) a[i] /= n;
}
complex<double> a[4 * MAXN], b[4 * MAXN];
long long c[200005];
long long num[200005];
vector<long long> v[200005];
struct node {
  long long id;
  friend bool operator<(const node &a, const node &b) {
    return v[a.id].size() > v[b.id].size();
  }
};
priority_queue<node> q;
void Merge(long long id1, long long id2) {
  long long sz1 = v[id1].size();
  long long sz2 = v[id2].size();
  long long nsiz = sz1 + sz2 - 1;
  long long len = 1;
  while (len <= nsiz) len <<= 1;
  for (long long i = 0; i < sz1; i++) a[i] = v[id1][i];
  for (long long i = sz1; i <= len; i++) a[i] = 0;
  for (long long i = 0; i < sz2; i++) b[i] = v[id2][i];
  for (long long i = sz2; i <= len; i++) b[i] = 0;
  fft(a, len, 1);
  fft(b, len, 1);
  for (long long i = 0; i <= len; i++) a[i] = a[i] * b[i];
  fft(a, len, -1);
  v[id1].clear();
  v[id2].clear();
  for (long long i = 0; i <= nsiz; i++) {
    v[id1].push_back(((long long)(a[i].real() + 0.5)) % 1009);
  }
}
vector<long long> bb;
int main() {
  long long n, m, k;
  scanf("%lld%lld%lld", &n, &m, &k);
  for (long long i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    c[x]++;
  }
  for (long long i = 1; i <= n; i++) num[c[i]]++;
  bb.push_back(1);
  long long nn = 0;
  v[nn] = bb;
  q.push(node{nn});
  nn++;
  for (long long i = 1; i <= n; i++) {
    bb.push_back(1);
    if (num[i] == 0) continue;
    for (long long k = 1; k <= num[i]; k++) {
      v[nn] = bb;
      q.push(node{nn});
      nn++;
    }
  }
  long long siz = q.size() - 1;
  while (siz--) {
    long long id1 = q.top().id;
    q.pop();
    long long id2 = q.top().id;
    q.pop();
    Merge(id1, id2);
    q.push(node{id1});
  }
  printf("%lld\n", (v[q.top().id][k] + 1009) % 1009);
  return 0;
}