#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (auto &i : a) cin >> i;
    sort(begin(a), end(a));
    int ans = 0;
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
      sum += a[n - 1 - i];
      if (sum >= 1LL * (i + 1) * x)
        ans = i + 1;
      else
        break;
    }
    cout << ans << '\n';
  }
}
