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 double pi = acos(-1);
long long read() {
  char ch = getchar();
  long long x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  return x * op;
}
int n, m, k, tot, tong[2000005];
struct comp {
  long double a, b;
  comp operator+(const comp &t) const { return (comp){a + t.a, b + t.b}; }
  comp operator-(const comp &t) const { return (comp){a - t.a, b - t.b}; }
  comp operator*(const comp &t) const {
    return (comp){a * t.a - b * t.b, a * t.b + b * t.a};
  }
} A[2000005], B[2000005];
vector<int> a[2000005], r[20];
vector<comp> w[20][2];
struct cmp {
  bool operator()(const int &x, const int &y) const {
    return ((int)(a[x]).size()) > ((int)(a[y]).size());
  }
};
void pre() {
  int n = 1;
  for (int k = (1); k <= (19); k++) {
    n <<= 1;
    r[k].resize(n + 3);
    w[k][0].resize(n + 3);
    w[k][1].resize(n + 3);
    for (int i = (0); i <= (n - 1); i++)
      r[k][i] = (r[k][i >> 1] >> 1) | ((i & 1) << k - 1);
    for (int i = (0); i <= (n - 1); i++)
      w[k][1][i] = w[k][0][i] =
          (comp){cos(2 * i * pi / n), sin(2 * i * pi / n)};
    w[k][0][n] = w[k][1][n] = (comp){1, 0};
    for (int i = (0); i <= (n - 1); i++) w[k][1][i] = w[k][0][n - i];
  }
}
void fft(comp a[], int All, int typ, int fl) {
  for (int i = (0); i <= (All - 1); i++)
    if (i < r[typ][i]) swap(a[i], a[r[typ][i]]);
  int n = 2, m = 1;
  for (; n <= All; m = n, n <<= 1)
    for (int i = 0; i < All; i += n)
      for (int k = 0; k < m; k++) {
        comp t = w[typ][fl][All / n * k] * a[i + m + k];
        a[i + m + k] = a[i + k] - t;
        a[i + k] = a[i + k] + t;
      }
  if (fl)
    for (int i = (0); i <= (All - 1); i++) a[i].a /= All;
}
void mul(vector<int> a, vector<int> b, vector<int> &c) {
  int n1 = ((int)(a).size()), m1 = ((int)(b).size()), n = 1, len = 0;
  for (; n <= n1 - 1 + m1 - 1; n <<= 1, len++)
    ;
  for (int i = (0); i <= (n1 - 1); i++) A[i] = (comp){(long double)a[i], 0};
  for (int i = (n1); i <= (n - 1); i++) A[i] = (comp){0, 0};
  for (int i = (0); i <= (m1 - 1); i++) B[i] = (comp){(long double)b[i], 0};
  for (int i = (m1); i <= (n - 1); i++) B[i] = (comp){0, 0};
  fft(A, n, len, 0);
  fft(B, n, len, 0);
  for (int i = (0); i <= (n - 1); i++) A[i] = A[i] * B[i];
  fft(A, n, len, 1);
  c.resize(n);
  for (int i = (0); i <= (n - 1); i++)
    c[i] = ((long long)(A[i].a + 0.5) % 1009);
}
int main() {
  n = read(), m = read(), k = read();
  for (int i = (1); i <= (n); i++) tong[read()]++;
  priority_queue<int, vector<int>, cmp> q;
  for (int i = (1); i <= (m); i++)
    if (tong[i]) {
      tot++;
      a[tot].push_back(1);
      while (tong[i]--) a[tot].push_back(1);
      q.push(tot);
    }
  pre();
  while ((int)q.size() > 1) {
    int x = q.top();
    q.pop();
    int y = q.top();
    q.pop();
    mul(a[x], a[y], a[++tot]);
    a[x].clear();
    a[y].clear();
    q.push(tot);
  }
  int x = q.top();
  cout << a[x][k] << endl;
  return 0;
}