#include <bits/stdc++.h>
int main() {
  using namespace std;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long n, x;
    cin >> n >> x;
    vector<long long> a(n);
    for (auto& i : a) cin >> i;
    sort(a.begin(), a.end());
    vector<long long> c(n, 0);
    c[n - 1] = a[n - 1];
    for (long long i = n - 2; i >= 0; i--) c[i] = c[i + 1] + a[i];
    long long lo, hi, mid;
    lo = 0, hi = n - 1;
    while (lo < hi) {
      mid = (lo + hi) / 2;
      if (double(double(c[mid]) / double(n - mid)) >= x)
        hi = mid;
      else
        lo = mid + 1;
    }
    if (double(double(c[lo]) / double(n - lo)) >= x)
      cout << n - lo << '\n';
    else
      cout << 0 << '\n';
  }
  return 0;
}
