// author: Krithika Goyal
#include <bits/stdc++.h>
#define forn(i, n, a) for (int i = a; i <= n; i++)
#define revn(i, n, a) for (int i = a; i >= n; i--)
#define pb(a) push_back(a);
#define endl "\n";
#define fastio                             \
    std::ios_base::sync_with_stdio(false); \
    std::cin.tie(NULL);
#define int long long
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define doublepr(x) cout << fixed << setprecision(10) << x
using ll = long long;
using ld = long double;
using namespace std;
typedef pair<int, int> pii;

int _power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

int invmod(int a, int m)
{
    return _power(a, m - 2, m);
}

void sieve(int n, vector<bool> &prime)
{
    for (int p = 2; p * p <= n; p++)
    {
        if (prime[p] == true)
        {
            for (int i = p * p; i <= n; i += p)
                prime[i] = false;
        }
    }
}

// template ends

int fact[1001], inFact[1001];
int MOD = 1e9 + 7;

int power(int n, int k)
{
    int res = 1;
    while (k)
    {
        if (k % 2)
        {
            res = (res * n) % MOD;
            k--;
        }
        else
        {
            n = (n * n) % MOD;
            k = k / 2;
        }
    }
    return res;
}

int C(int n, int k)
{
    if (n < k)
        return 0;
    int ans = (((fact[n] * inFact[n - k]) % MOD) * inFact[k]) % MOD;
    return ans;
}

signed main()
{
    int t;
    cin >> t;
    fact[0] = 1;
    inFact[0] = 1;
    forn(i, 1000, 1)
    {
        fact[i] = (i * fact[i - 1]) % MOD;
        inFact[i] = power(fact[i], MOD - 2);
    }
    while (t--)
    {
        int n, k;
        cin >> n >> k;
        vector<int> a(n);
        forn(i, n - 1, 0) cin >> a[i];
        sort(all(a), greater<int>());
        int sim = a[k - 1];
        int num = 0, minInd = -1;
        forn(i, n - 1, 0)
        {
            if (a[i] == sim)
            {
                num++;
                if (minInd == -1)
                    minInd = i;
            }
        }
        // cout << C(3, 2) << endl;
        cout << C(num, k - minInd) << endl;
    }
}