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 double PI = acos(-1);
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
unordered_map<long long, int, custom_hash> safe_map;
void fft(vector<complex<double>> &a, int n, bool invert) {
  for (int i = 1, j = 0; i <= n; i++) {
    int bit = n >> 1;
    while (j & bit) {
      j ^= bit;
      bit >>= 1;
    }
    j ^= bit;
    if (i < j) {
      swap(a[i], a[j]);
    }
  }
  for (int len = 2; len <= n; len <<= 1) {
    double angle = 2 * PI / len;
    if (invert) angle = -angle;
    complex<double> wcur(cos(angle), sin(angle));
    for (int i = 0; i < n; i += len) {
      complex<double> w(1, 0);
      for (int j = 0; j < len / 2; j++) {
        complex<double> u = a[i + j], v = w * a[i + j + len / 2];
        a[i + j] = u + v;
        a[i + j + len / 2] = u - v;
        w *= wcur;
      }
    }
  }
  if (invert) {
    for (int i = 0; i < n; i++) a[i] /= n;
  }
}
int multiply(vector<complex<double>> &a, vector<complex<double>> &b, int n1,
             int n2) {
  int n = 1;
  while (n < n1 + n2 - 1) n <<= 1;
  a.resize(n);
  b.resize(n);
  for (int i = n1; i < n; i++) a[i] = 0;
  for (int i = n2; i < n; i++) b[i] = 0;
  fft(a, n, false);
  fft(b, n, false);
  for (int i = 0; i < n; i++) {
    a[i] *= b[i];
  }
  fft(a, n, true);
  for (int i = 0; i < n; i++) a[i] = (round(a[i].real()));
  for (int i = 0; i < n; i++) {
    a[i] = (complex<double>)(((long long int)a[i].real()) % 1009);
  }
  return n1 + n2 - 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, M, K;
  cin >> N >> M >> K;
  int x, y, z;
  for (int i = 0; i < N; i++) {
    cin >> x;
    safe_map[x]++;
  }
  vector<vector<complex<double>>> temp_poly;
  vector<int> tempnum;
  int basenum = 1;
  x = 0;
  for (auto &s : safe_map) {
    y = s.second;
    tempnum.push_back(y + 1);
    temp_poly.push_back(vector<complex<double>>(y + 1));
    for (int i = 0; i < tempnum[x]; i++) {
      temp_poly[x][i] = 1;
    }
    x++;
  }
  for (y = 1; y <= x; y <<= 1) {
    for (int z = 0; z < x; z += 2 * y) {
      if (z + y < x) {
        multiply(temp_poly[z], temp_poly[z + y], tempnum[z], tempnum[z + y]);
        tempnum[z] = min(tempnum[z] + tempnum[z + y] - 1, K + 1);
      }
    }
  }
  cout << (int)temp_poly[0][K].real() << endl;
  return 0;
}