#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, x;
    cin >> n >> x;
    long long int arr[n], i, sum = 0, c = 0;
    for (i = 0; i < n; i++) {
      cin >> arr[i];
      arr[i] = arr[i] - x;
      sum = sum + arr[i];
    }
    sort(arr, arr + n);
    if (sum >= 0)
      cout << n << '\n';
    else {
      while (sum < 0) {
        for (c = 0; c < n; c++) {
          sum = sum - arr[c];
          if (sum >= 0) break;
        }
      }
      cout << n - (c + 1) << '\n';
    }
  }
}
