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;
constexpr int MAXLOG = 18;
constexpr int MAXN = 1 << MAXLOG;
constexpr int MOD = 1009;
using int64 = long long;
namespace fft {
using ld = double;
struct Complex {
  ld r, i;
  explicit Complex(ld _r = 0.0, ld _i = 0.0) : r{_r}, i{_i} {}
  Complex conjugate() const { return Complex{r, -i}; }
  Complex operator+(const Complex& b) const {
    return Complex{r + b.r, i + b.i};
  }
  Complex operator-(const Complex& b) const {
    return Complex{r - b.r, i - b.i};
  }
  Complex operator*(const Complex& b) const {
    return Complex{r * b.r - i * b.i, r * b.i + i * b.r};
  }
};
const ld PI = (ld)acosl(-1.0);
const Complex ZERO{0, 0};
int rev[MAXN];
Complex roots[MAXN];
void dft(vector<Complex>& A) {
  const int n = (int)A.size();
  int p = 0, q;
  for (q = 1; q < n; q += q, ++p)
    ;
  for (int i = 0; i < n; ++i) {
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (p - 1));
    if (i < rev[i]) swap(A[i], A[rev[i]]);
  }
  for (int k = 1; k < n; k += k) {
    for (int i = 0; i < n; i += 2 * k) {
      for (int j = 0; j < k; ++j) {
        Complex z = roots[j + k] * A[i + j + k];
        A[i + j + k] = A[i + j] - z;
        A[i + j] = A[i + j] + z;
      }
    }
  }
}
vector<Complex> fft(vector<Complex>& c, int fsz) {
  const int n = (int)c.size();
  vector<Complex> d(n, ZERO);
  dft(c);
  for (int i = 0; i < n; ++i) {
    int j = (i == 0 ? 0 : n - i);
    Complex a = c[j], b = c[i].conjugate();
    d[i] = ((a * a) - (b * b)) * Complex{0, -0.25 / n};
  }
  dft(d);
  d.resize(fsz);
  for (int i = 0; i < fsz; ++i) {
    d[i].r = (int)(((int64)(d[i].r + 0.5)) % MOD);
    d[i].i = 0;
  }
  return d;
}
void init() {
  constexpr int nc = MAXN;
  for (int i = 0; i < nc; ++i) {
    if (i < (nc / 2))
      roots[i + nc / 2] =
          Complex{(ld)cosl(i * 2.0 * PI / nc), (ld)sinl(i * 2.0 * PI / nc)};
  }
  for (int i = (nc / 2) - 1; i >= 1; --i) roots[i] = roots[2 * i];
}
vector<Complex> mul(const vector<Complex>& a, const vector<Complex>& b) {
  const int na = (int)a.size();
  const int nb = (int)b.size();
  int nc = 1;
  for (; nc < (na + nb - 1); nc += nc)
    ;
  vector<Complex> c(nc, ZERO);
  for (int i = 0; i < nc; ++i) {
    if (i < na) c[i].r = a[i].r;
    if (i < nb) c[i].i = b[i].r;
  }
  return fft(c, na + nb - 1);
}
}  // namespace fft
int cnt[MAXN], id = 0;
array<int, 2> s[MAXN];
vector<fft::Complex> poly[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  fft::init();
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++cnt[x];
  }
  priority_queue<array<int, 2>, vector<array<int, 2>>, greater<array<int, 2>>>
      pq;
  for (int i = 1; i < MAXN; ++i) {
    if (cnt[i] == 0) continue;
    pq.push({cnt[i], id});
    poly[id].assign(1 + cnt[i], fft::Complex{1, 0});
    id++;
  }
  while (pq.size() > 1) {
    auto x = pq.top();
    pq.pop();
    auto y = pq.top();
    pq.pop();
    pq.push({x[0] + y[0], x[1]});
    poly[x[1]] = fft::mul(poly[x[1]], poly[y[1]]);
  }
  cout << (int)(poly[pq.top()[1]][k].r + 0.5) << '\n';
  return 0;
}