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 double PI = acos(-1.0);
struct Complex {
  long double x, y;
  Complex(long double _x = 0.0, long double _y = 0.0) { x = _x, y = _y; }
  Complex operator-(const Complex &b) const {
    return Complex(x - b.x, y - b.y);
  }
  Complex operator+(const Complex &b) const {
    return Complex(x + b.x, y + b.y);
  }
  Complex operator*(const Complex &b) const {
    return Complex(x * b.x - y * b.y, x * b.y + y * b.x);
  }
};
void change(Complex y[], int len) {
  int i, j, k;
  for (i = 1, j = len / 2; i < len - 1; i++) {
    if (i < j) {
      Complex tmp = y[i];
      y[i] = y[j], y[j] = tmp;
    }
    k = len / 2;
    while (j >= k) {
      j = j - k;
      k = k / 2;
    }
    if (j < k) j += k;
  }
}
void fft(Complex y[], int len, int on) {
  change(y, len);
  for (int h = 2; h <= len; h <<= 1) {
    Complex wn(cos(-on * 2 * PI / h), sin(-on * 2 * PI / h));
    for (int j = 0; j < len; j += h) {
      Complex w(1, 0);
      for (int k = j; k < j + h / 2; k++) {
        Complex u = y[k];
        Complex t = w * y[k + h / 2];
        y[k] = u + t;
        y[k + h / 2] = u - t;
        w = w * wn;
      }
    }
  }
  if (on == -1) {
    for (int i = 0; i < len; i++) {
      y[i].x /= len;
    }
  }
}
const int N = 263000, mod = 1009;
Complex x1[2 * N], x2[2 * N];
int n, m, k;
int cnt[N];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    pque;
vector<int> cof[N];
void conv(int k1, int k2) {
  int len1 = cof[k1].size(), len2 = cof[k2].size(), len = 1;
  while (len < 2 * len1 || len < 2 * len2) len *= 2;
  for (int i = 0; i < len1; i++) x1[i] = Complex(cof[k1][i], 0);
  for (int i = 0; i < len2; i++) x2[i] = Complex(cof[k2][i], 0);
  for (int i = len1; i < len; i++) x1[i] = Complex();
  for (int i = len2; i < len; i++) x2[i] = Complex();
  fft(x1, len, 1), fft(x2, len, 1);
  for (int i = 0; i < len; i++) x1[i] = x1[i] * x2[i];
  fft(x1, len, -1);
  cof[k1].clear(), cof[k2].clear();
  for (int i = 0; i < len1 + len2 - 1; i++)
    cof[k1].push_back((long long)(x1[i].x + 0.5) % mod);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnt[a]++;
  }
  for (int i = 1; i <= m; i++) {
    if (cnt[i] > 0) {
      for (int j = 0; j <= cnt[i]; j++) cof[i].push_back(1);
      pque.push({cof[i].size(), i});
    }
  }
  while (pque.size() > 1) {
    int fir = pque.top().second;
    pque.pop();
    int sec = pque.top().second;
    pque.pop();
    conv(fir, sec);
    pque.push({cof[fir].size(), fir});
  }
  int i = pque.top().second;
  cout << cof[i][k] << endl;
}