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;
const int LN = 21;
const int N = (1 << LN) + 20;
const int PR = 1e6 + 5;
;
const double pi = acos(-1);
int rev[N], lol[N], buc[N], sv[N];
class base {
 public:
  double x, y;
  base(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  base operator+(const base &t) const { return base(x + t.x, y + t.y); }
  base operator-(const base &t) const { return base(x - t.x, y - t.y); }
  base operator*(const base &t) const {
    return base(x * t.x - y * t.y, x * t.y + y * t.x);
  }
  void operator/=(const int n) {
    x = x / n;
    y = y / n;
    return;
  }
  base conj() const { return base(x, -y); }
  double real() { return x; }
};
base wlr[N], a1[N], a2[N];
int K, P;
vector<int> v[N];
int k;
void build_rev(int n, int k) {
  for (int i = 0; i < n; i++) {
    rev[i] = 0;
    for (int j = 0; j < k; j++)
      if (i & (1 << j)) rev[i] |= (1 << (k - j - 1));
  }
}
void fft(int n, base *a, int invert) {
  for (int i = 0; i < n; i++)
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  wlr[0] = base(1, 0);
  for (int len = 2; len <= n; len = (len << 1)) {
    double ang = (2 * pi) / (double)len;
    if (invert) ang *= (double)(-1);
    int rng = len / 2;
    base wk = base(cos(ang), sin(ang));
    for (int i = 1; i < rng; i++) wlr[i] = wlr[i - 1] * wk;
    for (int i = 0; i < n; i += len) {
      for (int j = 0; j < rng; j++) {
        base u = a[i + j];
        base v = (a[i + j + rng] * wlr[j]);
        a[i + j] = u + v;
        a[i + j + rng] = u - v;
      }
    }
  }
  if (invert) {
    for (int i = 0; i < n; i++) a[i] /= n;
  }
}
vector<int> mult(vector<int> a, vector<int> b) {
  int len1 = a.size(), len2 = b.size(), P = 1, K = 0;
  while (P < (len1 + len2)) {
    P <<= 1;
    K++;
  }
  K = min(K, 18);
  P = (1 << K);
  for (int i = 0; i < P; i++) {
    a1[i] = base(0, 0);
    a2[i] = base(0, 0);
  }
  for (int i = 0; i < len1; i++) a1[i] = base(a[i], 0);
  for (int i = 0; i < len2; i++) a2[i] = base(b[i], 0);
  build_rev(P, K);
  fft(P, a1, 0);
  fft(P, a2, 0);
  for (int i = 0; i < P; i++) a1[i] = a1[i] * a2[i];
  fft(P, a1, 1);
  vector<int> ans(P);
  for (int i = 0; i < min(P, k + 2); i++) {
    long long x = (long long)(a1[i].real() + 0.5);
    ans[i] = ((int)(x % 1009ll));
  }
  return ans;
}
vector<int> solve(int l, int r) {
  if (l == r) return v[l];
  int mid = (l + r) >> 1;
  return mult(solve(l, mid), solve(mid + 1, r));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 0, n, m, i, j, x;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    buc[x]++;
  }
  int sz = 0;
  for (int i = 1; i <= m; i++) {
    if (buc[i]) {
      sz++;
      for (int j = 0; j <= buc[i]; j++) v[sz].push_back(1);
    }
  }
  vector<int> res = solve(1, sz);
  if (res.size() <= k)
    cout << "0\n";
  else
    cout << res[k] << "\n";
  return 0;
}