#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"iostream"
#include"cassert"
#include"cmath"
#include"cstdio"
#include"cstdlib"
#include"map"
#include"set"
#include"queue"
#include"vector"
#include"algorithm"
#include"numeric"
#include"stack"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
inline int in(){int x;scanf("%lld",&x);return x;}
const int mod=1e9+7;
const int N=1010;
int f[N],inv[N];
int modp(int a,int b){
	if(b==0)return 1;
	int u=modp(a,b/2);
	u*=u;u%=mod;
	if(b&1)return (a*u)%mod;
	return u;
}
int ncr(int n,int r){
	if(n<r)return 0;
	int res=f[n]*inv[r]%mod;
	res*=inv[n-r];return res%mod;
}
void solve(){
	vector<int> c(2000),c1(2000);
	int n=in();int k=in();
	vector<int> a(n);for(int &i:a){i=in();c[i]++;}
	sort(all(a));reverse(all(a));
	for(int i=0;i<k;i++){
		c1[a[i]]++;
	}
	int ans=1;
	for(int i=0;i<2000;i++){
		if(c1[i]){
			ans*=ncr(c[i],c1[i]);
			ans%=mod;
		}
	}
	cout<<ans<<"\n";
}
int32_t main()
{
	f[0]=1;for(int i=1;i<N;i++)f[i]=f[i-1]*i%mod;
	inv[N-1]=modp(f[N-1],mod-2);for(int i=N-2;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
	
	int t=in();
	while(t--)solve();

}

