#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, x, i, m = 1, second = 0;
  cin >> n >> x;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (i = n - 1; i >= 0; i--) {
    second += a[i];
    if (((second * 1.0) / m) < (x * 1.0)) break;
    m++;
  }
  cout << m - 1 << "\n";
}
signed main() {
  long long t = 1;
  cin >> t;
  while (t--) solve();
}
