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;
namespace math {
inline uint32_t nextPow2_32(uint32_t v) {
  if (!v) {
    return 1;
  }
  uint32_t res = 1U << (31 - __builtin_clz(v));
  return res == v ? res : res << 1;
}
template <typename T = double>
struct Complex {
  inline Complex(T _real = 0, T _imag = 0) : real(_real), imag(_imag) {}
  inline void operator=(const Complex<T>& o) {
    real = o.real;
    imag = o.imag;
  }
  inline void operator+=(const Complex<T>& o) {
    real += o.real;
    imag += o.imag;
  }
  inline Complex<T> operator-(const Complex<T>& o) const {
    Complex<T> res;
    res.initSub(*this, o);
    return res;
  }
  inline Complex<T> operator*(const Complex<T>& o) const {
    Complex<T> res;
    res.initMul(*this, o);
    return res;
  }
  inline void operator*=(const Complex<T>& o) {
    T originalReal = real;
    real = originalReal * o.real - imag * o.imag;
    imag = originalReal * o.imag + imag * o.real;
  }
  inline void operator/=(T scale) {
    real /= scale;
    imag /= scale;
  }
  inline void init(T _real = 0, T _imag = 0) {
    real = _real;
    imag = _imag;
  }
  inline void initConj(const Complex<T>& o) {
    real = o.real;
    imag = -o.imag;
  }
  inline void initPolar(T r, T theta) {
    real = r * cos(theta);
    imag = r * sin(theta);
  }
  inline void initMul(const Complex<T>& x, const Complex<T>& y) {
    real = x.real * y.real - x.imag * y.imag;
    imag = x.real * y.imag + x.imag * y.real;
  }
  inline void initSub(const Complex<T>& x, const Complex<T>& y) {
    real = x.real - y.real;
    imag = x.imag - y.imag;
  }
  inline Complex<T> conj() const { return Complex<T>(real, -imag); }
  inline void flip() {
    real = -real;
    imag = -imag;
  }
  T real, imag;
};
const long double PI = acos(static_cast<long double>(-1));
template <typename T = double>
struct FFTUtils {
  inline FFTUtils(int capacity = -1) {
    if (capacity > 0) {
      capacity = nextPow2_32(capacity);
    }
    capacity = max(capacity, 2);
    _revs.reserve(capacity);
    _revs.resize(2);
    _revs[0] = 0;
    _revs[1] = 1;
    _roots.reserve(capacity | 1);
    _roots.resize(3);
    _roots[0].init(0, 0);
    _roots[1].init(1, 0);
    _roots[2].init(1, 0);
    _initCapacity(capacity);
    _cs.reserve(capacity);
    _cs2.reserve(capacity);
  }
  inline const vector<Complex<T>>& mul(const vector<int>& x,
                                       const vector<int>& y) {
    int pow2 = nextPow2_32(static_cast<int>(x.size() + y.size()) - 1);
    _cs.resize(pow2);
    for (size_t i = 0; i < pow2; ++i) {
      _cs[i].init(i < x.size() ? x[i] : 0, i < y.size() ? y[i] : 0);
    }
    fft(_cs, false, pow2);
    _c.init(0, -0.25);
    for (int i = 0; i <= (pow2 >> 1); ++i) {
      int j = (pow2 - i) & (pow2 - 1);
      _c2.initMul(_cs[i] * _cs[i] - (_cs[j] * _cs[j]).conj(), _c);
      _cs[i].initConj(_c2);
      _cs[j] = _c2;
    }
    fft(_cs, false, pow2);
    for (auto& c : _cs) {
      c /= pow2;
    }
    _shrink(_cs);
    return _cs;
  }
  inline void fft(vector<Complex<T>>& cs, bool invert, int n = -1) {
    int pow2 = nextPow2_32(n < 0 ? static_cast<int>(cs.size()) : n);
    _initCapacity(pow2);
    _expand(pow2, cs);
    int shift = __builtin_ctz(_revs.size()) - __builtin_ctz(pow2);
    for (int i = 0; i < pow2; ++i) {
      int j = _revs[i] >> shift;
      if (i < j) {
        swap(cs[i], cs[j]);
      }
    }
    for (int l = 1; l < pow2; l <<= 1) {
      for (int i = 0, l2 = l << 1; i < pow2; i += l2) {
        int step = invert ? -1 : 1;
        for (int j = 0, k = invert ? (l << 1) : l; j < l; ++j, k += step) {
          _c.initMul(cs[i + j + l], _roots[k]);
          if (invert && j) {
            _c.flip();
          }
          cs[i + j + l].initSub(cs[i + j], _c);
          cs[i + j] += _c;
        }
      }
    }
    if (invert) {
      for (int i = 0; i < pow2; ++i) {
        cs[i] /= pow2;
      }
    }
  }
  inline void _expand(int pow2, vector<Complex<T>>& cs) {
    for (size_t i = cs.size(); i < pow2; ++i) {
      cs.emplace_back(0, 0);
    }
  }
  inline void _shrink(vector<Complex<T>>& cs) {
    for (; cs.size() > 1 && cs.back().real < 0.5; cs.pop_back()) {
    }
  }
  inline void _initCapacity(int pow2) {
    if (_revs.size() >= pow2) {
      return;
    }
    int oldPow2 = _revs.size(), lgN = __builtin_ctz(pow2);
    _revs.resize(pow2);
    for (int i = 0; i < pow2; ++i) {
      _revs[i] = (_revs[i >> 1] >> 1) + ((i & 1) << (lgN - 1));
    }
    _roots.resize(pow2 | 1);
    for (int i = oldPow2; i < pow2; i <<= 1) {
      T angle = PI / i, baseAngle = angle * 2;
      for (int j = i; j < i << 1; j += 2, angle += baseAngle) {
        _roots[j] = _roots[j >> 1];
        _roots[j | 1].initPolar(1, angle);
      }
    }
    _roots[pow2] = _roots[pow2 >> 1];
  }
  vector<int> _revs;
  vector<Complex<T>> _roots, _cs, _cs2;
  Complex<T> _c;
  Complex<T> _c2;
};
}  // namespace math
const int MAXN = 200000 + 2;
const int MAXN_05 = sqrt(MAXN) + 1;
const int MOD = 1009;
using COMPLEX_T = double;
int n, m, k, k1;
int colorCnt[MAXN];
math::FFTUtils<COMPLEX_T> fft(MAXN << 1);
inline void assign(vector<int>& res,
                   const vector<math::Complex<COMPLEX_T>>& cs) {
  res.resize(min(static_cast<int>(cs.size()), k1));
  for (size_t i = 0; i < res.size(); ++i) {
    auto v = static_cast<int64_t>(cs[i].real + 0.5);
    res[i] = v >= MOD ? v % MOD : v;
  }
}
vector<int> vs;
inline vector<int> calc(int lower, int upper) {
  if (lower + 1 == upper) {
    return vector<int>(min(vs[lower] + 1, k1), 1);
  }
  int medium = (lower + upper) >> 1;
  vector<int> xs = calc(lower, medium);
  vector<int> ys = calc(medium, upper);
  assign(xs, fft.mul(xs, ys));
  return xs;
}
int main() {
  vs.reserve(MAXN_05);
  while (scanf("%d%d%d", &n, &m, &k) != EOF && n) {
    k1 = k + 1;
    memset(colorCnt, 0, sizeof(int) * m);
    for (int i = 0; i < n; ++i) {
      int c;
      scanf("%d", &c);
      ++colorCnt[c - 1];
    }
    vs.clear();
    for (int i = 0; i < m; ++i) {
      if (colorCnt[i] > 0) {
        vs.push_back(colorCnt[i]);
      }
    }
    printf("%d\n", calc(0, vs.size())[k]);
  }
}