#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    double n, x;
    cin >> n >> x;
    vector<double> a(n);
    for (__typeof(n) i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a.rbegin(), a.rend());
    a.push_back(0);
    double no = 1, am = a[0];
    while ((am / no >= x) && (no <= n)) {
      am += a[no];
      no++;
    }
    cout << no - 1 << "\n";
  }
  return 0;
}
