#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    long int x;
    cin >> n >> x;
    vector<long int> savings;
    while (n--) {
      long int amt;
      cin >> amt;
      savings.push_back(amt - x);
    }
    sort(savings.begin(), savings.end(), greater<int>());
    long long int count = 0, sum = 0;
    for (auto xx : savings) {
      sum += xx;
      if (sum < 0) break;
      count++;
    }
    cout << count << endl;
  }
  return 0;
}
