#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define upb upper_bound
#define lwb lower_bound 
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y){
    if(y<=0) return 1;
    ll ans = 1;
    x %= mod;
    while(y){
        if(y&1)
            ans = (x * ans) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = (a - b); if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = (a + b); if(c >= mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

const ll N = 1e3 + 1;
//vector<ll> adj[N];
//bool visited[N];

ll modfac[N];
ll modfacinv[N];
ll invsi[N];

void simake(){
    invsi[0]=1;
    invsi[1]=1;
    
    modfac[0]=1;
    modfac[1]=1;

    modfacinv[0]=1;
    modfacinv[1]=1;
    
    for(ll i=2;i<N;i++)
    {
        invsi[i] = mul(invsi[mod%i], (mod-(mod/i)));
        modfac[i] = mul(i, modfac[i-1]);
        modfacinv[i] = mul(invsi[i], modfacinv[i-1]);
    }
}

ll nCrm(ll n,ll r){
    if(n==r||r==0) return 1;
    if(n<r) return 0;
    return mul(mul(modfac[n], modfacinv[r]), modfacinv[n-r]);
}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cout<<fixed<<setprecision(10);
    simake();
    
    int t;
    cin>>t;
    while(t--){
        ll n, k;
        cin>>n>>k;
        ll a[n];
        map<ll, ll> mp;
        for(int i=0;i<n;i++){
            cin>>a[i];
            mp[a[i]]++;
        }
        ll ans=1;
        sort(a, a+n, greater<ll>());
        ll x = a[k-1];
        map<ll, ll> mp1;
        for(int i=0;i<k;i++){
            mp1[a[i]]++;
        }
        cout<<nCrm(mp[x], mp1[x])<<"\n";
    }
    
    return 0;
}

