#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define rep(i, a, n) for(int i = a; i <= n; ++ i)
#define per(i, a, n) for(int i = n; i >= a; -- i)
//#define ONLINE_JUDGE
using namespace std;
typedef long long ll;
const int mod=1e9+7;
template<typename T>void write(T x)
{
    if(x<0)
    {
        putchar('-');
        x=-x;
    }
    if(x>9)
    {
        write(x/10);
    }
    putchar(x%10+'0');
}

template<typename T> void read(T &x)
{
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;};
ll ksm(ll a,ll n){
	ll ans=1;
	while(n){
		if(n&1) ans=(ans*a)%mod;
		a=a*a%mod;
		n>>=1;
	}
	return ans%mod;
}
//==============================================================
#define int ll
const int maxn=1e3+100;
int t,n,k,a[maxn];
ll cnt[maxn];
map<int,int>need;
ll f[maxn],finv[maxn];
void init(){
	f[0]=1;
	rep(i,1,maxn-1)f[i]=f[i-1]*i%mod;
	finv[maxn-1]=ksm(f[maxn-1],mod-2);
	per(i,0,maxn-2){
		finv[i]=(finv[i+1]*(i+1))%mod;
	}
}
ll C(ll n,ll k){
	return (f[n]*finv[n-k]%mod*finv[k]%mod)%mod;
}

signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	//clock_t c1 = clock();
	//===========================================================
	read(t);
	init();
	while(t--){
		need.clear();
		read(n),read(k);
		rep(i,1,n) read(a[i]);
		sort(a+1,a+1+n);
		int mx=0;
		ll ans=1;
		per(i,n-k+1,n)mx+=a[i],need[a[i]]++;
		rep(i,1,n)cnt[a[i]]++;
		for(auto x:need){
			int now=x.first;
			int num=x.second;
			ans=(ans*C(cnt[now],num))%mod;
		}
		write(ans%mod),putchar('\n');
		fill(cnt,cnt+n+1,0);
	}
	//===========================================================
	//std::cerr << "Time:" << clock() - c1 << "ms" << std::endl;
	return 0;
}
