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 T>
inline bool uax(T &x, T y) {
  return (y > x) ? x = y, true : false;
}
template <typename T>
inline bool uin(T &x, T y) {
  return (y < x) ? x = y, true : false;
}
void err(istream_iterator<string>) {}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> buf) {
  return os << "(" << buf.first << ": " << buf.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, vector<vector<T>> &A) {
  for (auto &B : A) os << '\n' << B;
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &A) {
  bool f = false;
  os << "{";
  for (const auto e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &A) {
  bool f = false;
  os << "{";
  for (const auto e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, multiset<T> &A) {
  bool f = false;
  os << "{";
  for (const auto e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, map<K, V> &A) {
  bool f = false;
  os << "{";
  for (auto &e : A) {
    if (f) os << ", ";
    os << e;
    f = true;
  }
  return os << "}";
}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl;
  err(++it, args...);
}
template <typename T>
void kek(T ans) {
  cout << ans << endl;
  exit(0);
}
int const MOD = 1000000007;
long long const INF = 1e18;
namespace FFT {
const double PI = acos(-1);
const int MOD = 1009;
int bits[1 << 22];
void prepare_cache(int n) {
  int lg = 0;
  while (1 << lg + 1 < n) ++lg;
  for (int i = 1; i < n; ++i) bits[i] = (bits[i >> 1] >> 1) | ((i & 1) << lg);
}
void fft(vector<complex<double>> &a, bool invert) {
  int n = (int)a.size();
  if (n == 1) return;
  for (int i = 1; i < n; i++) {
    if (i > bits[i]) swap(a[i], a[bits[i]]);
  }
  for (int len = 1; len < n; len <<= 1) {
    const double theta = (invert ? -1 : 1) * PI / len;
    const complex<double> wroot(cos(theta), sin(theta));
    for (int i = 0; i < n; i += len << 1) {
      complex<double> w(1);
      for (int j = 0; j < len; j++) {
        complex<double> u = a[i + j], v = a[i + j + len] * w;
        a[i + j] = u + v;
        a[i + j + len] = u - v;
        w *= wroot;
      }
    }
  }
  if (invert)
    for (complex<double> &x : a) x /= n;
}
vector<int> multiply(vector<int> const &a, vector<int> const &b) {
  vector<complex<double>> fa(a.begin(), a.end()), fb(b.begin(), b.end());
  int n = 1;
  while (n < (int)(a.size() + b.size())) n += n;
  fa.resize(n);
  fb.resize(n);
  prepare_cache(n);
  fft(fa, false);
  fft(fb, false);
  for (int i = 0; i < n; i++) fa[i] *= fb[i];
  fft(fa, true);
  vector<int> result(n);
  for (int i = 0; i < n; i++)
    result[i] = (int)((long long)round(fa[i].real()) % MOD);
  return result;
}
}  // namespace FFT
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> counts(m);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    --x;
    counts[x]++;
  }
  vector<vector<int>> poly;
  for (int i = 0; i < m; ++i) poly.emplace_back(counts[i] + 1, 1);
  auto order = [&](int i, int j) {
    if (poly[i].size() == poly[j].size()) return i < j;
    return poly[i].size() < poly[j].size();
  };
  set<int, decltype(order)> s(order);
  for (int i = 0; i < m; ++i)
    if (counts[i] > 0) s.insert(i);
  while (true) {
    int i = *s.begin();
    s.erase(i);
    if (s.empty()) kek(poly[i][k]);
    int j = *s.begin();
    s.erase(j);
    poly[i] = FFT::multiply(poly[i], poly[j]);
    s.insert(i);
  }
  return 0;
}