#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) is >> x;
  return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];
  }
  return os;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    cin >> a;
    sort((a).begin(), (a).end(), greater<int>());
    long long sum = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      sum += a[i];
      if (sum >= (i + 1LL) * x) ans = i + 1;
    }
    cout << ans << '\n';
  }
  return 0;
}
