#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    double a[n];
    vector<double> less;
    double richSum = 0;
    long long richCount = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] < x) {
        less.push_back(a[i]);
      } else {
        richSum += a[i];
        richCount++;
      }
    }
    long long ans = richCount;
    if (richCount > 0) {
      sort(less.rbegin(), less.rend());
      for (double c : less) {
        if ((c + richSum) / (richCount + 1) >= x) {
          richSum += c;
          richCount++;
        }
      }
    }
    cout << richCount << "\n";
  }
  return 0;
}
