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;
struct point {
  double x, y;
  point() {
    x = 0;
    y = 0;
  }
  point(double _x, double _y) {
    x = _x;
    y = _y;
  }
  point(double _x) {
    x = _x;
    y = 0;
  }
  point operator*(point p) {
    return point(x * p.x - y * p.y, x * p.y + y * p.x);
  }
  point operator+(point p) { return point(x + p.x, y + p.y); }
};
double real(point p) { return p.x; }
const long double pi = acosl(-1);
point prep[1100007];
point v[2][1100007];
vector<point> dft(vector<point> P, int w) {
  int k = round(log2(P.size()));
  int n = P.size();
  prep[0] = 1;
  for (int i = 1; i <= n; i++)
    prep[i] = point(cos(pi * 2. / n * i), sin(pi * 2. / n * i) * w);
  for (int i = 0; i < n; i++) v[0][i] = P[i];
  for (int l = 1, jump = n / 2; l <= k; l++, jump /= 2)
    for (int pol = 0; pol < jump; pol++)
      for (int i = 0; i < n; i += jump)
        v[l % 2][pol + i] = v[(l + 1) % 2][pol + (2 * i) % n] +
                            v[(l + 1) % 2][pol + (2 * i + jump) % n] * prep[i];
  return vector<point>(v[k % 2], v[k % 2] + n);
}
vector<point> to_points(vector<int> *v) {
  vector<point> res(v->size());
  for (int i = 0; i < v->size(); i++) res[i] = point(v->at(i), 0);
  return res;
}
void cut(vector<int> *res) {
  while (!res->back()) res->pop_back();
}
vector<int> *brute(vector<int> *a, vector<int> *b) {
  vector<int> *res = new vector<int>(a->size() + b->size());
  for (int i = 0; i < a->size(); i++)
    for (int j = 0; j < b->size(); j++)
      res->at(i + j) = (res->at(i + j) + a->at(i) * b->at(j)) % 1009;
  cut(res);
  return res;
}
vector<int> *multiply(vector<int> *a, vector<int> *b) {
  if (a->size() * b->size() < 10000) return brute(a, b);
  vector<point> A, B;
  A = to_points(a);
  B = to_points(b);
  delete a;
  delete b;
  int n = 2;
  while (n < A.size() || n < B.size()) n *= 2;
  n *= 2;
  A.resize(n, 0);
  B.resize(n, 0);
  A = dft(A, 1);
  B = dft(B, 1);
  vector<point> V(n);
  for (int i = 0; i < n; i++) V[i] = A[i] * B[i];
  V = dft(V, -1);
  vector<int> *res = new vector<int>(n);
  for (int i = 0; i < n; i++)
    res->at(i) = (long long)(round(real(V[i]) / n)) % 1009LL;
  cut(res);
  return res;
}
int n, m, k;
int cnt[200007];
vector<vector<int> *> V, V2;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  for (int i = 1; i <= m; i++) {
    if (cnt[i]) {
      V.push_back(new vector<int>(cnt[i] + 1, 1));
    }
  }
  while (V.size() > 1) {
    for (int i = 0; i < V.size(); i += 2) {
      if (i + 1 < V.size())
        V2.push_back(multiply(V[i], V[i + 1]));
      else
        V2.push_back(V[i]);
    }
    V.clear();
    swap(V, V2);
  }
  printf("%d\n", V[0]->at(k));
  return 0;
}