#include <bits/stdc++.h>
using namespace std;
long long mpow(long long b, long long ex) {
  if (b == 1) return 1;
  long long r = 1;
  while (ex) {
    if (ex & 1) r = (r * b) % 1000000007;
    ex = ex >> 1;
    b = (b * b) % 1000000007;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  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.begin(), a.end());
    vector<long long> b(n);
    b[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; i--) {
      b[i] = a[i] + b[i + 1];
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      if (b[i] / (n - i) >= x) {
        ans = n - i;
        break;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
