#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, x, f = 0, p = 0;
    cin >> n >> x;
    long long a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    for (int i = n - 1; i >= 0; i--) {
      p += a[i] - x;
      if (p < 0) break;
      f++;
    }
    cout << f;
    cout << endl;
  }
  return 0;
}
