#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, x;
  cin >> n >> x;
  long long *arr = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  if (arr[n - 1] < x)
    cout << 0;
  else {
    long long sum = arr[n - 1];
    long long cnt = 1;
    for (long long i = n - 2; i >= 0; i--) {
      if ((sum + arr[i]) / (double)(cnt + 1) >= (double)x) {
        sum += arr[i];
        cnt++;
      } else
        break;
    }
    cout << cnt;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
