#include<bits/stdc++.h>
using namespace std;
#define fi              first
#define se              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll           pair<long long,long long>
#define vi              vector<int>
#define vl              vector<long long>
#define mii            map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define mod             1000000007
#define inf             1e18
#define ld            long double
#define w(t)            int t; cin>>t; while(t--)
#define f(i,x)             for(int i=0;i<x;i++)
#define rep(i,a,b)      for(int i=a;i<=b;i++)
ll power(ll a,ll b)
{
ll res=1;
while(b)
{
    if(b&1)
    {
        res=(res*a)%mod;
    }
    b/=2;
    a=(a*a)%mod;
}
return res;
}
void solve(ll com[])
{
ll n,k;
cin>>n>>k;
ll a[n];
f(i,n)
{
    cin>>a[i];
}
sort(a,a+n,greater<ll>());


ll v=count(a,a+n,a[k-1]);
ll c=0;
f(i,k)
{
    if(a[i]>a[k-1])
    {
        c++;
    }else
    {
        break;
    }
    

}

c=k-c;
//cout<<power(com[c],mod-2)<<" "<<c<<"\n";
cout<<((((com[v])*(power(com[c],mod-2)))%mod)*(power(com[v-c],mod-2)))%mod<<"\n";



}
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll com[1001]={0};
com[0]=1;
rep(i,1,1000)
{
    com[i]=((ll)i*com[i-1])%mod;
}
w(t){solve(com);}
 return 0;
}