#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, x;
    cin >> n >> x;
    vector<long long> a(n);
    for (auto& p : a) cin >> p;
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    long long k = 0, su = a[0];
    if (a[0] >= x) {
      k = 1;
    } else {
      k = 0;
      cout << k << "\n";
      continue;
    }
    for (long long i = 1; i < n; i++) {
      if (su / k < x) {
        k--;
        break;
      }
      k++;
      su += a[i];
    }
    if (su / k < x) {
      k--;
    }
    cout << k << "\n";
  }
  return 0;
}
