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