#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define ll long long
#define ull unsigned long long
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PIL pair<int, ll>
#define endl '\n'
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1|1
#define IOS std::ios::sync_with_stdio(false),cin.tie(0), cout.tie(0)
#define debug(x) cerr << #x <<" = "<< x << endl
#define debug2(x, y) cerr << #x << " = " << x << " and " << #y << " = " << y << endl
#define Pi acos(-1)
using namespace std;

const int mod = 1e9 + 7;
const int N = 3e5 + 100;

int c[1005][1005], a[N], b[1005];

void init()
{
    for(int i = 1; i <= 1000; ++ i)
    {
        c[i][0] = c[i][i] = 1;
        for(int j = 1; j < i; ++ j)
            c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
    }
}

int main() 
{
    IOS;
    init();
    int _;
    cin >> _;
    while(_ --)
    {
        map<int, int> MP;
        int n, k;
        cin >> n >> k;
        for(int i = 0; i < n; ++ i) cin >> a[i], MP[a[i]] ++;

        for(auto i = MP.rbegin(); i != MP.rend(); ++ i) {
            int d = i->second;
            if(d >= k)
            {
                cout << c[d][k] << endl;
                break;
            }
            k -= d;
        }
    }
    return 0;
}
