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 = 1 << 19;
const int mod = 1009;
const double Pi = acos(-1.);
const int INF = numeric_limits<int>::max();
void read(int &x) {
  x = 0;
  char ch = getchar();
  int f = 1;
  while (!isdigit(ch)) (ch == '-' ? f = -1 : 0), ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
int qsm(int a, int b) {
  int tmp = 1;
  while (b) {
    if (b & 1) tmp = (1ll * tmp * a) % mod;
    b >>= 1;
    a = (1ll * a * a) % mod;
  }
  return tmp;
}
int rev[N];
struct Com {
  double x, y;
  Com(double x = 0.0, double y = 0.0) : x(x), y(y) {}
  Com operator-(const Com &b) const { return Com(x - b.x, y - b.y); }
  Com operator+(const Com &b) const { return Com(x + b.x, y + b.y); }
  Com operator*(const Com &b) const {
    return Com(x * b.x - y * b.y, x * b.y + y * b.x);
  }
} a[N], b[N], c[N];
void FFT(Com *a, int n, int f) {
  for (int i = 0; i <= n - 1; ++i)
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  for (int i = 1; i < n; i <<= 1) {
    Com wn = Com(cos(Pi / i), sin(Pi / i)), x, y;
    for (int j = 0; j < n; j += (i << 1)) {
      Com w = Com(1, 0);
      for (int k = 0; k < i; ++k, w = w * wn) {
        x = a[j + k];
        y = a[i + j + k] * w;
        a[j + k] = x + y;
        a[i + j + k] = x - y;
      }
    }
  }
  if (f == 1) return;
  reverse(a + 1, a + n);
  for (int i = 0; i <= n - 1; ++i) a[i].x /= n, a[i].y /= n;
}
int ans[N], L, g, n, m, k, x, cnt[N];
vector<int> poly[N];
set<pair<int, int> > s;
void mul(int A, int B) {
  int l = ((int)(poly[A]).size()), r = ((int)(poly[B]).size());
  for (int i = 0; i <= l - 1; ++i) a[i] = Com(poly[A][i], 0);
  for (int j = 0; j <= r - 1; ++j) b[j] = Com(poly[B][j], 0);
  for (L = 1, g = 0; L <= (l + r - 1); L <<= 1, ++g)
    ;
  for (int i = l; i <= L - 1; ++i) a[i] = Com(0, 0);
  for (int i = r; i <= L - 1; ++i) b[i] = Com(0, 0);
  for (int i = 0; i <= L - 1; ++i)
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (g - 1));
  FFT(a, L, 1);
  FFT(b, L, 1);
  for (int i = 0; i <= L - 1; ++i) c[i] = a[i] * b[i];
  FFT(c, L, -1);
  vector<int> C(l + r - 1, 0);
  for (int i = 0; i <= l + r - 2; ++i) C[i] = ((long long)(c[i].x + 0.5)) % mod;
  poly[m] = C;
  return;
}
vector<int> tmp;
signed main() {
  read(n);
  read(m);
  read(k);
  for (int i = 1; i <= n; ++i) read(x), cnt[x]++;
  for (int i = 1; i <= m; ++i)
    if (cnt[i]) {
      poly[i] = vector<int>(cnt[i] + 1, 1);
      s.insert(make_pair(cnt[i] + 1, i));
    }
  ++m;
  while (((int)(s).size()) > 1) {
    int u = s.begin()->second;
    s.erase(s.begin());
    int v = s.begin()->second;
    s.erase(s.begin());
    mul(u, v);
    s.insert(make_pair(((int)(poly[m]).size()), m));
    ++m;
  }
  printf("%d", poly[s.begin()->second][k]);
  return 0;
}