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