#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, x;
  cin >> n >> x;
  std::vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort((v).begin(), (v).end(), greater<long long>());
  long long ans = 0;
  long long count = 0;
  for (long long i = 0; i < n; i++) {
    ans += v[i];
    if (ans / (i + 1) >= x) {
      count++;
    } else {
      break;
    }
  }
  cout << count << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
