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