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