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