#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long m) {
  long long r = 1;
  for (; y; y >>= 1) {
    if (y & 1) r = r * x % m;
    x = x * x % m;
  }
  return r;
}
const long long N = 1e6 + 5, M = 1e18 + 7;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long n, k, t, m = 0, x = 0, i, ans = 0, j, y = 0, z = 4, c = 0;
  cin >> t;
  while (t--) {
    cin >> n >> x;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    c = 0;
    ans = 0;
    for (i = n - 1; i >= 0; i--) {
      c += a[i];
      if ((long double)((long double)c / (long double)(n - i)) >= x) {
        ans = n - i;
      }
    }
    cout << ans << "\n";
  }
}
