#include <bits/stdc++.h>
using namespace std;

typedef long long int llint;
#define fi first
#define se second
#define ipair pair<int,int>
#define llpair pair<long long,long long>

llint maxll(llint a,llint b){
    return (a>b)?a:b;
}
llint minll(llint a,llint b){
    return (a<b)?a:b;
}
llint gcd(llint a,llint b){
    if (b == 0)
        return a;
    return gcd(b,a%b);
}
llint lcm(llint a,llint b)
{
    return (a/gcd(a,b))*b;
}

llint gcdExtended(llint a, llint b, llint *x, llint *y); 
  
// Function to find modulo inverse of b. It returns 
// -1 when inverse doesn't 
llint modInverse(llint b, llint m) 
{ 
    llint x, y; // used in extended GCD algorithm 
    llint g = gcdExtended(b, m, &x, &y); 
  
    // Return -1 if b and m are not co-prime 
    if (g != 1) 
        return -1; 
  
    // m is added to handle negative x 
    return (x%m + m) % m; 
} 
  
// Function to compute a/b under modlo m 
llint modDivide(llint a, llint b, llint m) 
{ 
    a = a % m; 
    llint inv = modInverse(b, m); 
    if (inv == -1) 
       return -1;
    else
       return (inv * a) % m; 
} 
  
// C function for extended Euclidean Algorithm (used to 
// find modular inverse. 
llint gcdExtended(llint a, llint b, llint *x, llint *y) 
{ 
    // Base Case 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    llint x1, y1; // To store results of recursive call 
    llint gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    // Update x and y using results of recursive 
    // call 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;cin>>t;
    while(t--){
        int n,k;cin>>n>>k;
        vector<int> a(n);
        llint mod=1000000007;
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        sort(a.begin(),a.end(),greater<int>());
        vector<llint> ans(k+1);
        vector<llint> mv(k+1);
        ans[0]=1;
        int rep=1;
        int prevmv=-1;
        for(int i=1;i<=k;i++){
            int maxval=a[i-1];
            int c=1;
            if(prevmv==maxval){
                rep++;
            }
            else{
                rep=1;
            }
            prevmv=maxval;
            for(int j=i;j<n;j++){
                if(a[j]!=maxval){
                    break;
                }
                c++;
            }
            //mv[i]=maxval;
            //ans[i]=c;
            ans[i]=modDivide(ans[i-1]*c,rep,mod);
            //cout<<ans[i]<<endl;
        }
        cout<<ans[k]<<endl;
    }
}
