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