// Problem: E. Advertising Agency
// Contest: Codeforces - Codeforces Round #697 (Div. 3)
// URL: https://codeforces.com/problemset/problem/1475/E
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define PB emplace_back
#define MP make_pair
#define all(x) (x).begin(), (x).end()
#define int long long

using namespace std;
typedef long long LL;
const int N = 1e3 + 50, mod = 1e9 + 7;
int t, n, m, inv[N];

int qmi(int a, int k)
{
	int res = 1;
	while (k)
	{
		if (k & 1)  res = res * a % mod;
		a = a * a % mod;
		k >>= 1;
	}
	
	return res;
}

int C(int n, int m)
{
	if (n > m)  return 0;
	int ans = inv[m] * qmi(inv[n] * inv[m - n] % mod, mod - 2) % mod;
	return ans;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

	inv[0] = inv[1] = 1;
	for (int i = 2;i < N;i ++)  inv[i] = (i * inv[i - 1]) % mod;
    cin >> t;

    while (t --)
    {
        cin >> n >> m;
        vector<int> a(n + 1);
        map<int, int> mp; // 记录第i个大的个数
        int cnt = 0, cur = -1, ans = 0;
        for (int i = 1;i <= n;i ++)  cin >> a[i];
        sort(a.begin() + 1, a.end(), greater<int>());
        
        for (int i = 1;i <= n;i ++)
        {
        	if (a[i] != cur)
        	{
        		//cout << "cur : " << cur << "\tmp[cnt] :" << mp[cnt] << endl;
        		cur = a[i], mp[++ cnt] ++;
        	}
        	else  mp[cnt] ++;
        }
        //cout << "cur : " << cur << "\tmp[cnt] :" << mp[cnt] << endl;
        		
        for (int i = 1;i <= cnt;i ++)
        {
        	if (mp[i] >= m)
        	{
        		//cout << m << " " << mp[i] << endl;
        		ans = C(m, mp[i]);
        		break;
        	}
        	else  m -= mp[i];
        }
        
        cout << ans << endl;
    }

    return 0;
}
