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 INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f;
const long long MOD = 1000000007;
const int IT_MAX = 1 << 17;
const int MX = 1000005;
namespace FFT {
const double C_PI = acos(-1);
void fft(vector<complex<double> > &a, bool invert) {
  int n = ((int)(a).size());
  for (int i = 0, j = 0; i < n; ++i) {
    if (i > j) swap(a[i], a[j]);
    for (int k = n >> 1; (j ^= k) < k; k >>= 1)
      ;
  }
  for (int len = 2; len <= n; len <<= 1) {
    double ang = 2 * C_PI / len * (invert ? -1 : 1);
    complex<double> wlen(cos(ang), sin(ang));
    for (int i = 0; i < n; i += len) {
      complex<double> w(1);
      for (int j = 0; j < len / 2; j++) {
        if ((j & 511) == 511) w = complex<double>(cos(ang * j), sin(ang * j));
        complex<double> u = a[i + j], v = a[i + j + len / 2] * w;
        a[i + j] = u + v;
        a[i + j + len / 2] = u - v;
        w *= wlen;
      }
    }
  }
  if (invert) {
    for (int i = 0; i < n; i++) a[i] /= n;
  }
}
void multiply(const vector<int> &a, const vector<int> &b, vector<int> &res,
              const int MOD) {
  vector<complex<double> > fa((a).begin(), (a).end()),
      fb((b).begin(), (b).end());
  int n = 1;
  while (n < max(((int)(a).size()), ((int)(b).size()))) n <<= 1;
  n <<= 1;
  fa.resize(n);
  fb.resize(n);
  fft(fa, false);
  fft(fb, false);
  for (int i = 0; i < n; i++) fa[i] *= fb[i];
  fft(fa, true);
  res.resize(n);
  for (int i = 0; i < n; i++)
    res[i] =
        ((long long)(fa[i].real() + (fa[i].real() > 0 ? 0.5 : -0.5))) % MOD;
}
void multiply_with_modulo(const vector<int> &a, const vector<int> &b,
                          vector<int> &res, const int MOD) {
  int n = 1;
  while (n < max(((int)(a).size()), ((int)(b).size()))) n <<= 1;
  n <<= 1;
  vector<complex<double> > A(n), B(n);
  int L_BLOCK = 15;
  for (int i = 0; i < n; i++)
    A[i] = (i < ((int)(a).size())
                ? complex<double>(a[i] & ((1 << L_BLOCK) - 1), a[i] >> L_BLOCK)
                : complex<double>(0));
  for (int i = 0; i < n; i++)
    B[i] = (i < ((int)(b).size())
                ? complex<double>(b[i] & ((1 << L_BLOCK) - 1), b[i] >> L_BLOCK)
                : complex<double>(0));
  fft(A, false);
  fft(B, false);
  vector<complex<double> > f1(n), f2(n), f3(n), f4(n);
  for (int i = 0; i < n; i++) {
    int j = (n - i) & (n - 1);
    f2[i] = (A[i] + conj(A[j])) * complex<double>(0.5, 0);
    f1[i] = (A[i] - conj(A[j])) * complex<double>(0, -0.5);
    f4[i] = (B[i] + conj(B[j])) * complex<double>(0.5, 0);
    f3[i] = (B[i] - conj(B[j])) * complex<double>(0, -0.5);
  }
  for (int i = 0; i < n; i++) {
    A[i] = f1[i] * f3[i] + f1[i] * f4[i] * complex<double>(0, 1);
    B[i] = f2[i] * f4[i] * complex<double>(0, 1) + f2[i] * f3[i];
  }
  fft(A, true);
  fft(B, true);
  res.resize(n);
  for (int i = 0; i < n; i++) {
    long long g1 = (long long)(A[i].real() + 0.5) % MOD;
    long long g2 = (long long)(A[i].imag() + 0.5) % MOD;
    long long g3 = (long long)(B[i].real() + 0.5) % MOD;
    long long g4 = (long long)(B[i].imag() + 0.5) % MOD;
    res[i] = (g4 + ((g2 + g3) << L_BLOCK) + (g1 << (L_BLOCK << 1))) % MOD;
  }
}
void multiply_big(const vector<int> &a, const vector<int> &b,
                  vector<long long> &res) {
  int n = 1;
  while (n < max(((int)(a).size()), ((int)(b).size()))) n <<= 1;
  n <<= 1;
  vector<complex<double> > A(n), B(n);
  int L_BLOCK = 10;
  for (int i = 0; i < n; i++)
    A[i] = (i < ((int)(a).size())
                ? complex<double>(a[i] & ((1 << L_BLOCK) - 1), a[i] >> L_BLOCK)
                : complex<double>(0));
  for (int i = 0; i < n; i++)
    B[i] = (i < ((int)(b).size())
                ? complex<double>(b[i] & ((1 << L_BLOCK) - 1), b[i] >> L_BLOCK)
                : complex<double>(0));
  fft(A, false);
  fft(B, false);
  vector<complex<double> > f1(n), f2(n), f3(n), f4(n);
  for (int i = 0; i < n; i++) {
    int j = (n - i) & (n - 1);
    f2[i] = (A[i] + conj(A[j])) * complex<double>(0.5, 0);
    f1[i] = (A[i] - conj(A[j])) * complex<double>(0, -0.5);
    f4[i] = (B[i] + conj(B[j])) * complex<double>(0.5, 0);
    f3[i] = (B[i] - conj(B[j])) * complex<double>(0, -0.5);
  }
  for (int i = 0; i < n; i++) {
    A[i] = f1[i] * f3[i] + f1[i] * f4[i] * complex<double>(0, 1);
    B[i] = f2[i] * f4[i] * complex<double>(0, 1) + f2[i] * f3[i];
  }
  fft(A, true);
  fft(B, true);
  res.resize(n);
  for (int i = 0; i < n; i++) {
    long long g1 = (long long)(A[i].real() + 0.5);
    long long g2 = (long long)(A[i].imag() + 0.5);
    long long g3 = (long long)(B[i].real() + 0.5);
    long long g4 = (long long)(B[i].imag() + 0.5);
    res[i] = (g4 + ((g2 + g3) << (L_BLOCK)) + (g1 << (L_BLOCK << 1)));
  }
}
}  // namespace FFT
int n, m, k;
vector<int> X[200020];
int A[200020];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    --x;
    A[x]++;
  }
  for (int i = 0; i < m; i++) {
    X[i].resize(A[i] + 1);
    for (int j = 0; j < A[i] + 1; j++) X[i][j] = 1;
  }
  for (int i = 1; i < m; i *= 2) {
    for (int j = 0; i + j < m; j += 2 * i) {
      FFT::multiply(X[j], X[j + i], X[j], 1009);
      while ((int)(X[j]).size() > 1 && X[j].back() == 0) X[j].pop_back();
    }
  }
  printf("%d\n", (int)(X[0]).size() < k + 1 ? 0 : X[0][k]);
  return 0;
}