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>
const long long mod = 1009;
using namespace std;
int nnn, mm, goal, aa[200005];
vector<int> mjk[200005];
vector<int> lst;
vector<int> TMP;
namespace fftRR {
const int MN = (int)1e6;
int ffa[MN], ffb[MN];
long long ffres[MN];
int my_round(double x) {
  if (x < 0) return -my_round(-x);
  return (int)(x + 1e-3);
}
const double PI = acos((double)-1.0);
int rev[MN];
complex<double> wlen_pw[MN], fa[MN], fb[MN];
void fft(complex<double> a[], int n, bool invert) {
  for (int i = 0; i < n; ++i)
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  for (int len = 2; len <= n; len <<= 1) {
    double alpha = 2 * PI / len * (invert ? -1 : +1);
    int len2 = len >> 1;
    wlen_pw[0] = complex<double>(1, 0);
    complex<double> wlen(cos(alpha), sin(alpha));
    for (int i = 1; i < len2; ++i) wlen_pw[i] = wlen_pw[i - 1] * wlen;
    for (int i = 0; i < n; i += len) {
      complex<double> t, *pu = a + i, *pv = a + i + len2,
                         *pu_end = a + i + len2, *pw = wlen_pw;
      for (; pu != pu_end; ++pu, ++pv, ++pw) {
        t = *pv * *pw;
        *pv = *pu - t;
        *pu += t;
      }
    }
  }
  if (invert)
    for (int i = 0; i < n; i++) a[i] /= n;
}
void calcRev(int n, int logn) {
  for (int i = 0; i < n; i++) {
    rev[i] = 0;
    for (int j = 0; j < logn; j++)
      if (i & (1 << j)) rev[i] |= 1 << (logn - 1 - j);
  }
}
void mulpoly(int a[], int b[], long long c[], int na, int nb, int &n) {
  int l = max(na, nb), logn = 0;
  for (n = 1; n < l; n <<= 1) ++logn;
  n <<= 1;
  ++logn;
  calcRev(n, logn);
  for (int i = 0; i < n; i++) fa[i] = fb[i] = complex<double>(0);
  for (int i = 0; i < na; i++) fa[i] = complex<double>(a[i]);
  for (int i = 0; i < nb; i++) fb[i] = complex<double>(b[i]);
  fft(fa, n, false);
  fft(fb, n, false);
  for (int i = 0; i < n; i++) fa[i] *= fb[i];
  fft(fa, n, true);
  for (int i = 0; i < n; i++) c[i] = (long long)(fa[i].real() + 0.5);
}
}  // namespace fftRR
int main() {
  iostream::sync_with_stdio(0);
  cin >> nnn >> mm >> goal;
  for (int i = 1; i <= nnn; i++) {
    int x;
    cin >> x;
    ++aa[x];
  }
  for (int i = 1; i <= mm; i++) {
    if (!aa[i]) continue;
    lst.push_back(i);
    mjk[i].assign(aa[i] + 1, 1);
  }
  while (lst.size() > 1) {
    sort(lst.begin(), lst.end(),
         [&](int &x, int &y) { return mjk[x].size() < mjk[y].size(); });
    vector<int> zzz;
    for (int i = 0; i < ((int)lst.size() + 1) / 2; i++) {
      int other = (int)lst.size() - 1 - i;
      if (i == other) {
        zzz.push_back(lst[i]);
        continue;
      }
      for (int j = 0; j < mjk[lst[i]].size(); j++)
        fftRR::ffa[j] = mjk[lst[i]][j];
      for (int j = 0; j < mjk[lst[other]].size(); j++)
        fftRR::ffb[j] = mjk[lst[other]][j];
      for (int j = 0; j < mjk[lst[i]].size() + mjk[lst[other]].size() - 1; j++)
        fftRR::ffres[j] = 0;
      int tmp = 0;
      fftRR::mulpoly(fftRR::ffa, fftRR::ffb, fftRR::ffres, mjk[lst[i]].size(),
                     mjk[lst[other]].size(), tmp);
      mjk[lst[i]].assign(mjk[lst[i]].size() + mjk[lst[other]].size() - 1, 0);
      for (int j = 0; j < mjk[lst[i]].size(); j++)
        mjk[lst[i]][j] = fftRR::ffres[j] % mod;
      zzz.push_back(lst[i]);
    }
    lst = zzz;
  }
  cout << mjk[lst[0]][goal];
}