#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
T amax(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
void SOLVE() {
  long long n, x;
  cin >> n >> x;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort((v).begin(), (v).end());
  reverse((v).begin(), (v).end());
  long long i = 0;
  long long cnt = 1;
  long long sum = 0;
  long long num = 0;
  while (1) {
    if (i == n) {
      break;
    }
    sum += v[i];
    double d = double(sum) / double(cnt);
    if (d >= x) {
      i++;
      cnt++;
      num++;
    } else {
      break;
    }
  }
  cout << num << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TC = 1;
  cin >> TC;
  while (TC--) {
    SOLVE();
  }
  return 0;
}
