#include <bits/stdc++.h>

using namespace std;
#define debug(x) std::cout << #x << " is " << (x) << endl;
#define int long long

const int mod = 1e9 + 7;

int qpow(int a, int n, int mod)
{
    long long ans = 1;
    while (n)
    {
        if (n & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ans;
}

int inv(int a, int mod)
{
    //mod是质数,利用费马小定理
    return qpow(a, mod - 2, mod);
}

int fact(int n, int mod)
{
    long long ans = 1;
    for (int i = 2; i <= n; i++)
        ans = ans * i % mod;
    return ans;
}

int C(int n, int m, int mod)
{
    if (n < 0 || m < 0 || m > n)
        return 0;
    if (n == m)
        return 1;
    return (fact(n, mod) % mod * inv(fact(m, mod), mod) % mod * inv(fact(n - m, mod), mod) % mod) % mod;
}

int Lucas(int n, int m, int p)
{
    if (m == 0)
        return 1;
    return C(n % p, m % p, p) * Lucas(n / p, m / p, p) % p;
}

signed main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n, k;
        cin >> n >> k;
        map<int, int> m;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            m[num]++;
        }
        int res = 1;
        for (auto i = m.rbegin(); i != m.rend(); i++)
        {
            if (k > 0 and i->second > k)
            {
                res *= Lucas(i->second, k, mod);
                break;
            }
            k -= i->second;
        }
        cout << res << endl;
    }
    return 0;
}