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;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T maxs(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T mins(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
long long n, m, k;
void fft(vector<complex<double>>& a, bool direction) {
  if ((long long)a.size() == 1) return;
  long long n = (long long)a.size();
  for (long long i = 1, j = 0; i < n; i++) {
    long long bit = n >> 1;
    for (; j >= bit; bit >>= 1) j -= bit;
    j += bit;
    if (i < j) swap(a[i], a[j]);
  }
  for (long long d = 2; d <= n; d <<= 1) {
    double ang = 2 * 3.141592653589793238 / d * (direction ? -1 : 1);
    complex<double> wd(cos(ang), sin(ang));
    for (long long i = 0; i < n; i += d) {
      complex<double> w(1);
      for (long long j = 0; j < d / 2; ++j) {
        complex<double> u = a[i + j], v = a[i + j + d / 2] * w;
        a[i + j] = u + v;
        a[i + j + d / 2] = u - v;
        w *= wd;
      }
    }
  }
  if (direction) {
    for (long long i = 0; i < n; ++i) a[i] /= n;
  }
}
void multiply(vector<long long>& a, vector<long long>& b,
              vector<long long>& c) {
  vector<complex<double>> A(a.begin(), a.end()), B(b.begin(), b.end());
  long long n = 1;
  while (n < max((long long)a.size(), (long long)b.size())) n = n << 1;
  n = n << 1;
  A.resize(n), B.resize(n);
  fft(A, false);
  fft(B, false);
  for (long long i = 0; i < n; i++) {
    A[i] = A[i] * B[i];
  }
  fft(A, true);
  c.resize(n);
  for (long long i = 0; i < n; i++) c[i] = (long long)(A[i].real() + 0.5);
  while ((long long)c.size() > k + 1) c.pop_back();
  for (long long i = 0; i < (long long)c.size(); i++) c[i] %= 1009;
}
long long solve() {
  cin >> n >> m >> k;
  multiset<pair<long long, vector<long long>>> st;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) {
    long long t;
    cin >> t;
    mp[t]++;
  }
  for (auto i : mp) {
    vector<long long> v(i.second + 1, 1);
    st.insert({i.second + 1, v});
  }
  while (st.size() > 1) {
    auto itr = st.begin();
    vector<long long> p1 = itr->second;
    ++itr;
    vector<long long> p2 = itr->second;
    st.erase(st.begin());
    st.erase(st.begin());
    vector<long long> c;
    multiply(p1, p2, c);
    st.insert({(long long)c.size(), c});
  }
  vector<long long> v = st.begin()->second;
  cout << v[k] % 1009 << "\n";
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}