#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
long long a[N];
int main() {
  long long T, n, x;
  cin >> T;
  while (T--) {
    long long ans = 0, z = 0;
    cin >> n >> x;
    for (long long i = 0; i < n; i++) scanf("%lld", a + i);
    sort(a, a + n);
    for (long long i = n - 1; i >= 0; i--) {
      z += a[i];
      if (z >= (ans + 1) * x)
        ans++;
      else
        break;
    }
    cout << ans << endl;
  }
  return 0;
}
