#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long int modInverse(long long int n) { return power(n, 1000000007 - 2); }
long long int fermat(long long int n, long long int r) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % 1000000007;
  return (fac[n] * modInverse(fac[r]) % 1000000007 * modInverse(fac[n - r]) %
          1000000007) %
         1000000007;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  long long int arr[n];
  long long int sum = 0;
  set<long long int> s;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
    s.insert(arr[i]);
  }
  long long int x = n + k - 1;
  long long int y = s.size();
  if (x <= 0)
    cout << 0 << "\n";
  else {
    cout << (fermat(x, n - 1) % 1000000007) / y << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  ;
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
