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