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 Arg1>
void prn(Arg1&& arg1) {
  cout << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void prn(Arg1&& arg1, Args&&... args) {
  cout << arg1 << " ";
  prn(args...);
}
template <typename Arg1>
void prs(Arg1&& arg1) {
  cout << arg1 << " ";
}
template <typename Arg1, typename... Args>
void prs(Arg1&& arg1, Args&&... args) {
  cout << arg1 << " ";
  prs(args...);
}
template <typename Arg1>
void read(Arg1&& arg1) {
  cin >> arg1;
}
template <typename Arg1, typename... Args>
void read(Arg1&& arg1, Args&&... args) {
  cin >> arg1;
  read(args...);
}
inline void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  for (int tc = 1; tc <= t; ++tc) {
    solve();
  }
  return 0;
}
namespace fft {
struct base {
  double x, y;
  base() { x = y = 0; }
  base(double _x, double _y) { x = _x, y = _y; }
  base(double _x) { x = _x, y = 0; }
  void operator=(double _x) { x = _x, y = 0; }
  double real() { return x; }
  double imag() { return y; }
  base operator+(const base& b) { return base(x + b.x, y + b.y); }
  void operator+=(const base& b) { x += b.x, y += b.y; }
  base operator*(const base& b) {
    return base(x * b.x - y * b.y, x * b.y + y * b.x);
  }
  void operator*=(const base& b) {
    double p = x * b.x - y * b.y, q = x * b.y + y * b.x;
    x = p, y = q;
  }
  void operator/=(double k) { x /= k, y /= k; }
  base operator-(const base& b) { return base(x - b.x, y - b.y); }
  void operator-=(const base& b) { x -= b.x, y -= b.y; }
  base conj() { return base(x, -y); }
  base operator/(double k) { return base(x / k, y / k); }
  void Print() { cerr << x << " + " << y << "i\n"; }
};
double PI = 2.0 * acos(0.0);
const int MAXN = 19;
const int maxn = 1 << MAXN;
base W[maxn], invW[maxn], P1[maxn], Q1[maxn];
bool fst = 1;
void precompute_powers() {
  for (int i = 0; i < maxn / 2; i++) {
    double ang = (2 * PI * i) / maxn;
    double _cos = cos(ang), _sin = sin(ang);
    W[i] = base(_cos, _sin);
    invW[i] = base(_cos, -_sin);
  }
}
void fft(vector<base>& a, bool invert) {
  if (fst) precompute_powers(), fst = 0;
  int n = (int)a.size();
  for (int i = 1, j = 0; i < n; ++i) {
    int bit = n >> 1;
    for (; j >= bit; bit >>= 1) j -= bit;
    j += bit;
    if (i < j) swap(a[i], a[j]);
  }
  for (int len = 2; len <= n; len <<= 1) {
    for (int i = 0; i < n; i += len) {
      int ind = 0, add = maxn / len;
      for (int j = 0; j < len / 2; ++j) {
        base u = a[i + j],
             v = (a[i + j + len / 2] * (invert ? invW[ind] : W[ind]));
        a[i + j] = (u + v);
        a[i + j + len / 2] = (u - v);
        ind += add;
      }
    }
  }
  if (invert)
    for (int i = 0; i < n; ++i) a[i] /= n;
}
vector<long long> mult(vector<long long>& a, vector<long long>& b,
                       long long mod) {
  int n1 = a.size(), n2 = b.size();
  int final_size = a.size() + b.size() - 1;
  int n = 1;
  while (n < final_size) n <<= 1;
  vector<base> P(n), Q(n);
  int SQRTMOD = (int)sqrt(mod) + 10;
  for (int i = 0; i < n1; i++) P[i] = base(a[i] % SQRTMOD, a[i] / SQRTMOD);
  for (int i = 0; i < n2; i++) Q[i] = base(b[i] % SQRTMOD, b[i] / SQRTMOD);
  fft(P, 0);
  fft(Q, 0);
  base A1, A2, B1, B2, X, Y;
  for (int i = 0; i < n; i++) {
    X = P[i];
    Y = P[(n - i) % n].conj();
    A1 = (X + Y) * base(0.5, 0);
    A2 = (X - Y) * base(0, -0.5);
    X = Q[i];
    Y = Q[(n - i) % n].conj();
    B1 = (X + Y) * base(0.5, 0);
    B2 = (X - Y) * base(0, -0.5);
    P1[i] = A1 * B1 + A2 * B2 * base(0, 1);
    Q1[i] = A1 * B2 + A2 * B1;
  }
  for (int i = 0; i < n; i++) P[i] = P1[i], Q[i] = Q1[i];
  fft(P, 1);
  fft(Q, 1);
  vector<long long> ret(final_size);
  for (int i = 0; i < final_size; i++) {
    long long x = (long long)(P[i].real() + 0.5);
    long long y = (long long)(P[i].imag() + 0.5) % mod;
    long long z = (long long)(Q[i].real() + 0.5);
    ret[i] = (x + ((y * SQRTMOD + z) % mod) * SQRTMOD) % mod;
  }
  return ret;
}
}  // namespace fft
const int N = 2e5 + 1, mod = 1009;
int f[N];
int n, m, k;
bool operator<(vector<long long>& v1, vector<long long>& v2) {
  return v1.size() > v2.size();
}
vector<vector<long long> > polys;
struct compar {
  bool operator()(int i1, int i2) {
    return polys[i1].size() > polys[i2].size();
  }
};
inline void solve() {
  read(n, m, k);
  for (int i = 0; i < n; ++i) {
    int cur;
    read(cur);
    ++f[cur];
  }
  priority_queue<int, vector<int>, compar> pq;
  polys.push_back(vector<long long>(1, 1));
  for (int i = 1; i <= m; ++i) {
    if (!f[i]) {
      continue;
    }
    polys.push_back(vector<long long>(f[i] + 1, 1));
  }
  for (int i = 0; i < polys.size(); ++i) {
    pq.push(i);
  }
  while (pq.size() > 1) {
    int i1 = pq.top();
    vector<long long>& p1 = polys[i1];
    pq.pop();
    vector<long long>& p2 = polys[pq.top()];
    pq.pop();
    p1 = fft::mult(p1, p2, mod);
    if (p1.size() > k + 1) {
      p1.resize(k + 1);
    }
    pq.push(i1);
  }
  vector<long long>& p = polys[pq.top()];
  int ans = 0;
  p.resize(k + 1);
  prn(p.back());
}