#define ll long long
#define lld float
#define M 202
#define f first
#define s second
#define pi 3.141592653589793238
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define N 100002
#define Endl endl
#define maxx(a,b,c,d) max(max(a,b),max(d,c))
#define minn(a,b,c,d) min(min(a,b),min(d,c))
#define pb push_back
#define mod 1000000007  
#define pp 31
#define ss(v) sort(v.begin(),v.end())
#define sr(v) sort(v.begin(),v.end(),greater<ll>())
#define rin(A, B, C) (((A)<=(B))&&((B)<=(C)))
#include <bits/stdc++.h>
using namespace std;
ll f[1001];
ll power(ll a, ll b)
{
	if(!b)return 1LL;
	ll aa=power(a,b/2);
	if(b%2)return aa*aa%mod*a%mod;
	return aa*aa%mod;
}
ll im(ll a)
{
	return power(a,mod-2);
}
ll ncr(ll n,ll r)
{
	return f[n]*im(f[r])%mod*im(f[n-r])%mod;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	// freopen("output.txt", "w", stdout);
	// freopen("input.txt", "r", stdin);
	ll t;
	cin>>t;
	f[0]=1;
	for(ll i=1;i<=1000;i++)
	{
		f[i] = (f[i-1]*i)%mod;
	}
	while(t--)
	{
		ll n,k;
		cin>>n>>k;
		map<ll,ll> m;
		vl v(n);
		for(ll i=0;i<n;i++)
		{
			cin>>v[i];
			m[v[i]]++;
		}
		sr(v);
		ll sum=0,prev=v[0];
		ll num=v[k-1];
		for(ll i=0;i<k;i++)
		{
			if(v[i]==num) sum++;
		}
		cout<<ncr(m[num],sum)<<endl;
	}
	
	return 0;
}
