#include <bits/stdc++.h>
using namespace std;
const int mod2 = 998244353;
const int mod = 1e9 + 7;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int N = 2e5 + 5;
template <typename A>
istream& operator>>(istream& input, vector<A>& x) {
  for (auto& i : x) input >> i;
  return input;
}
template <typename A>
ostream& operator<<(ostream& output, vector<A>& x) {
  for (auto& i : x) output << i << ' ';
  return output;
}
int32_t main() {
  io();
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long sum = 0, div, each, cnt = 0;
    sort(a, a + n, greater<int>());
    for (int i = 0; i < n; i++) {
      sum += a[i];
      div = i + 1;
      each = sum / div;
      if (each >= x)
        cnt++;
      else
        break;
    }
    cout << cnt << "\n";
  }
}
