#include<bits/stdc++.h>
using namespace std;
const int mod= 1e9+7;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define what_is(x) cerr << #x << " = " << x << endl;
typedef long long ll;
ll c[1009][1009];
int main()
{
    fastIO
    c[0][0]=1;
    for (int i=1; i<=1000; ++i)
    {
        c[i][0]=1;
        for (int j=1; j<=i; ++j)
        {
            c[i][j]=c[i-1][j-1]+c[i-1][j];
            c[i][j]%=mod;
        }
    }
    int t;
    cin>>t;

    while(t--)
    {
        int n,k;
        cin>>n>>k;

        vector<int>v(n);
        map<int,int>mp;
        for (int i=0; i<n; ++i)
            cin>>v[i],mp[v[i]]++;
        sort(v.rbegin(),v.rend());

        ll ans=1,x=1;
        for (int i=0; i<k; ++i)
        {
            if (i+1<k && v[i]==v[i+1])
            {
                ++x;
                continue;
            }
            ans*=c[mp[v[i]]][x];
            ans%=mod;
            x=1;
        }
        cout<<ans<<"\n";
    }
}
