#include<bits/stdc++.h>
using namespace std;
typedef long long Int;

int constexpr MOD = 1000000007;
int constexpr maxn = 1e3 + 10;

int t, n, k, a[maxn];

Int power(Int a, int p) {
  Int x = 1;
  while(p) {
    if(p&1) (x *= a) %= MOD;
    (a *= a) %= MOD;
    p >>= 1;
  }

  return x;
}

int main()
{
  cin >> t;
  while(t--) {
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];

    sort(a, a+n);
    reverse(a, a+n);

    vector<int> cnt;
    cnt.push_back(1);
    for(int i = 1; i < n; i++) {
      if(a[i] != a[i-1]) cnt.push_back(1);
      else cnt.back()++;
    }

    Int ans = 1;
    for(int c: cnt) {
      if(k > c) k -= c;
      else {
        for(int f = 1; f <= k; f++, c--) {
          (ans *= c) %= MOD;
          (ans *= power(f, MOD-2)) %= MOD;
        }
        break;
      }
    }

    cout << ans << endl;
  }

  return 0;
}
