#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t;
  cin >> t;
  while (t--) {
    long long n, x, sum = 0, ans = 0, cur;
    cin >> n >> x;
    priority_queue<long long> nums;
    for (int i = 0; i < n; ++i) {
      cin >> cur;
      nums.push(cur - x);
    }
    for (int i = 0; i < n && sum >= 0; ++i) {
      sum += nums.top();
      nums.pop();
      if (sum < 0) break;
      ++ans;
    }
    cout << ans << endl;
  }
}
