#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592654;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    long long n, x;
    cin >> n >> x;
    vector<long long> savings(n);
    for (long long i = 0; i < n; i++) {
      cin >> savings[i];
    }
    sort(savings.begin(), savings.end(), greater<long long>());
    long long save = 0;
    long long ans = 0;
    for (long long i = 0; i < savings.size(); i++) {
      save += savings[i];
      if (save >= (i + 1) * x) {
        ans++;
      } else {
        break;
      }
    }
    cout << ans << "\n";
  }
}
