#include <bits/stdc++.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>

#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vpi vector<pii>
#define vpl vector<pll>
#define pb push_back
#define all(v) v.begin(),v.end()
#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL);


void cout_vector(vi v){
	for (ll unsigned i=0; i<v.size(); i++) cout << v[i] << " ";
	cout<<endl;
}

int sum_vector(vi v){
	return accumulate(all(v),0);
}

void sort_vector(vi&v){
	sort(all(v));
}

void sort_comp(vi &v, bool func(int,int)){
	sort(all(v),func);
}

bool comp(int a,int b){
	if(b==1) return 0;
	if(a==1) return 1;
	return a>b;
}

ll gcd(ll a, ll b){
	while(a){
		ll temp =a;
		a=b%a;
		b=temp;
	}
	return b;
}

ll lcm(ll a, ll b){
	return (a*b)/gcd(a,b);
}

string binary(ll num){
	string ans="";
	do{
		ans=to_string(num%2)+ans;
		num/=2;
	}while(num);
	return ans;
}


const int mxn = 3e3+17;
const ll mod = 1e9+7;

ll pwr(ll num, ll p, ll modi){
	ll res=1;
	while(p>0){
		if(p&1){res*=num; res%=modi;}
		num*=num;
		num%=modi;
		p/=2;
	}
	return res; 
}

ll inverse(ll num){
	return pwr(num,mod-2,mod);
}

ll fac[1100];
ll invfac[1100];

void solve(){
	int n,k;
	cin>>n>>k;
	int num;
	map<int,int> fol;
	vi v;
	for(int i=0;i<n;i++){
		cin>>num;
		fol[num]++;
		if(fol[num]==1)v.pb(num);
	}
	sort(all(v));
	reverse(all(v));
	int p=0;
	ll ans=1;
	while(k>0){
		if(fol[v[p]]<=k){
			k-=fol[v[p]];
			p++;
		}
		else{
			ans*=fac[fol[v[p]]];
			ans%=mod;
			ans*=invfac[k];
			ans%=mod;
			ans*=invfac[fol[v[p]]-k];
			ans%=mod;
			break;
		}
	}
	cout<<ans<<"\n";
}


int main()
{
	fac[0]=1;
	fac[1]=1;
	for(int i=2;i<1050;i++){
		fac[i]=(fac[i-1]*i);
		fac[i]%=mod;
	}
	for(int i=0;i<1050;i++){
		invfac[i]=inverse(fac[i]);
	}
	fast_io
	int t;
	//t=1;
	cin>>t;
	while(t--) solve();
	
	return 0;
}
