#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, x, i;
    cin >> n >> x;
    long long ar[n];
    for (i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n);
    double sum = 0;
    long long cnt = 0;
    long long ans = 0;
    for (i = n - 1; i >= 0; i--) {
      sum += ar[i];
      cnt++;
      double temp = sum / cnt;
      if (temp >= x) {
        ans = cnt;
      }
    }
    cout << ans << endl;
  }
}
