#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  ll n, x, sum = 0;
  cin >> n >> x;
  vector<ll> v(n);
  for (auto &i : v) {
    cin >> i;
  }
  sort(v.rbegin(), v.rend());
  ll s = 0;
  for (int i = 0; i < n; ++i) {
    s += v[i];
    if (s / (i + 1) < x) {
      cout << i << '\n';
      return;
    }
  }
  cout << n << '\n';
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
