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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
using ll = long long;
using clx = complex<double>;
template <typename T>
using v = vector<T>;
static const ll PRIME = 1009;
static const double pi = 2.0 * acos(0.0);
v<clx> roots;
ll getmod(ll a, ll mod) {
  assert(mod > 0);
  return (a % mod + mod) % mod;
}
ll log2ll(ll a) {
  ll result = 0;
  while (a >>= 1) result++;
  return result;
}
ll pow2ll(ll a) { return (1LL << a); }
v<ll> getreverse(ll deg) {
  ll n = 1 + log2ll(deg), twon = pow2ll(n);
  v<ll> result(twon);
  for (ll i = 1; i < twon; i++) {
    result[i] = (result[i >> 1] >> 1) | ((i & 1) << (n - 1));
  }
  return result;
}
v<clx> getroots(ll deg) {
  ll twok = pow2ll(1 + log2ll(deg));
  v<clx> res(twok);
  for (ll i = 0; i < twok / 2; i++) {
    double angle = (2 * pi * i) / twok;
    res[i + twok / 2] = clx(cos(angle), sin(angle));
  }
  for (ll i = twok / 2 - 1; i >= 1; i--) {
    res[i] = res[2 * i];
  }
  return res;
}
v<clx> fft(const v<clx>& coefs, const v<ll>& reverse) {
  assert(coefs.size() == reverse.size());
  ll twok = coefs.size();
  v<clx> f(twok);
  for (ll i = 0; i < twok; i++) {
    f[i] = coefs[reverse[i]];
  }
  for (ll k = 1; k < twok; k <<= 1) {
    for (ll i = 0; i < twok; i += 2 * k) {
      for (ll j = 0; j < k; j++) {
        clx r = f[i + j + k] * roots[j + k];
        f[i + j + k] = f[i + j] - r;
        f[i + j] += r;
      }
    }
  }
  return f;
}
v<ll> mul(const v<ll>& a, const v<ll>& b) {
  ll adeg = a.size() - 1, bdeg = b.size() - 1, newdeg = adeg + bdeg;
  ll n = 1 + log2ll(newdeg), twon = pow2ll(n);
  v<clx> in(twon);
  for (ll i = 0; i < twon; i++) {
    in[i] = clx(i <= adeg ? a[i] : 0, i <= bdeg ? b[i] : 0);
  }
  v<ll> reverse = getreverse(newdeg);
  v<clx> out = fft(in, reverse);
  for (ll i = 0; i < twon; i++) {
    ll j = i ? (twon - i) : 0;
    in[i] = (out[j] * out[j] - conj(out[i] * out[i])) * clx(0.0, -0.25);
  }
  out = fft(in, reverse);
  v<ll> result(newdeg + 1);
  for (ll i = 0; i <= newdeg; i++) {
    result[i] = getmod(llround(out[i].real() / twon), PRIME);
  }
  return result;
}
int main(int argc, char const* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ll n, m, k, color;
  cin >> n >> m >> k;
  roots = getroots(n);
  v<ll> colorcount(m);
  for (ll i = 0; i < n; i++) {
    cin >> color;
    colorcount[color - 1]++;
  }
  auto fn = [](const v<ll>& a, const v<ll>& b) { return a.size() > b.size(); };
  priority_queue<v<ll>, v<v<ll>>, decltype(fn)> minpoly(fn);
  for (ll i = 0; i < m; i++) {
    if (colorcount[i] > 0) {
      minpoly.push(v<ll>(colorcount[i] + 1, 1));
    }
  }
  while (minpoly.size() > 1) {
    v<ll> p0 = minpoly.top();
    minpoly.pop();
    v<ll> p1 = minpoly.top();
    minpoly.pop();
    minpoly.push(mul(p0, p1));
  }
  v<ll> finalpoly = minpoly.top();
  cout << finalpoly[k] << endl;
  return 0;
}