#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF_LL = 1e18 + 3;
const int INF_int = 1e9 + 3;
int main() {
  int t;
  cin >> t;
  int ans[t];
  for (int ii = 0; ii < t; ii++) {
    int n;
    long long x;
    cin >> n >> x;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end(), greater<long long>());
    int now = -1;
    long long now_money = 0LL;
    long long min_wealth = 0LL;
    for (int i = 0; i < n; i++) {
      if (now_money < min_wealth)
        break;
      else {
        now_money += a[i];
        min_wealth += x;
        now++;
      }
    }
    if (now_money >= min_wealth) now++;
    ans[ii] = now;
  }
  for (int i = 0; i < t; i++) cout << ans[i] << endl;
}
