#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mod 1000000007
#define inf 100000000000000000
#define ar array
#define send ios::sync_with_stdio(false);
#define help cin.tie(0);
#define setpres(x) fixed<<setprecision(x)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) { for(int i=0;i<v.size();i++) cout<<v[i]<<" "; cout<<"\n";}
template<typename A,typename B> ostream& operator<<(ostream &cout, map<A,B> const &v) { for(auto x:v) cout<<x.first<<": "<<x.second<<"\n";}
template<typename A> ostream& operator<<(ostream &cout, vector<ar<A,2>> const &v) { for(int i=0;i<v.size();i++) cout<<v[i][0]<<" "<<v[i][1]<<"\n";}

int a[2000];
int n,k;
int cnt[1001], fact[1001];
void f()
{
    fact[0]=1;
    for(int i=1;i<=1000;i++)
        fact[i]=(fact[i-1]*i)%mod;
}
int pw(int a, int b)
{
    int ans=1ll;
    a%=mod;
    while(b)
    {
        if(b%2)
            ans=(ans*a)%mod;
        b/=2;
        a=(a*a)%mod;
    }
    return ans;
}
int inv(int x)
{
    return pw(x,mod-2);;
}
int ncrp(int n, int r)
{
    if(r==0)
        return 1;
    return (fact[n]*inv(fact[r])%mod*inv(fact[n-r])%mod)%mod;
}

void wrong_answer_on_test_2()
{
    cin>>n>>k;
    memset(cnt,0,sizeof(cnt));
    for(int i=0;i<n;i++)
        cin>>a[i], cnt[a[i]]++;
    sort(a,a+n,greater<int>());
    int ans=1;
    int c1[1001]={0};
    set<int> s;
    for(int i=0;i<k;i++)
        c1[a[i]]++, s.insert(a[i]);
    // for(int i=1;i<=4;i++)
    //     cout<<cnt[i]<<" ";
    // cout<<"\n";
    // for(int i=1;i<=4;i++)
    //     cout<<c1[i]<<" ";
    // cout<<"\n";
    for(auto x:s)
        ans=(ans*ncrp(cnt[x],c1[x]));
    cout<<ans<<"\n";

}
int32_t main()
{
    send help
    f();
    int tt=1;
    cin>>tt;
    while(tt--)
    {
        wrong_answer_on_test_2();
    }
}