#include <bits/stdc++.h>
using namespace std;
void solve() {
  int64_t n, x;
  cin >> n >> x;
  vector<int> a(n);
  int ai;
  int64_t total = 0;
  for (int i = 0; i < n; i++) {
    cin >> ai;
    a[i] = ai;
    total += ai;
  }
  sort(a.begin(), a.end());
  int i = 0;
  bool p = true;
  while (n) {
    if (x * n <= total) {
      p = false;
      cout << n << endl;
      break;
    }
    total -= a[i];
    i++;
    n--;
  }
  if (p) cout << 0 << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
