#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define per(i,a,b) for(int i=(a),i##end=(b);i>=i##end;i--)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int N=1005;
const int mod=1e9+7;
int n,cnt,d[N],k,p[N],a[N]; 
inline int read(){
	int f=1,x=0;
	char ch=getchar();
	while(ch>'9'||ch<'0') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
inline int binpow(int a,int b){
	int res=1;
	while(b){
		if(b&1) res=1ll*res*a%mod;
		a=1ll*a*a%mod;
		b=b>>1;
	}
	return res;
}
inline void solve(){
	mem(d,0);
	n=read(),k=read();
	rep(i,1,n) a[i]=read(),d[a[i]]++;
	sort(a+1,a+n+1);
	per(i,n,n-k+1){
		if(a[i]!=a[i+1]) cnt=0;
		cnt++;
	}
	int o=d[a[n-k+1]];
	printf("%d\n",1ll*p[o]*binpow(p[cnt],mod-2)%mod*binpow(p[o-cnt],mod-2)%mod);
}
int main(){
	int T=read();
	p[0]=1;
	rep(i,1,1000) p[i]=1ll*p[i-1]*i%mod; 
	while(T--) solve();
	return 0;
}

