#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
void solve() {
  long long n, x;
  cin >> n >> x;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long count = 0;
  double sum = 0;
  sort(a.begin(), a.end(), greater<long long>());
  for (int i = 0; i < n; i++) {
    if (a[i] >= x) {
      sum += a[i];
      count++;
    } else {
      sum += a[i];
      count++;
      if (sum / count < x) {
        cout << count - 1 << endl;
        return;
      }
    }
  }
  cout << n << endl;
}
int main() {
  long long k;
  cin >> k;
  while (k--) {
    solve();
  }
  return 0;
}
