#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    long long x;
    cin >> n >> x;
    long long a[n];
    long long sum = 0;
    int count = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] >= x) {
        sum += a[i] - x;
        count++;
        a[i] = x;
      }
    }
    sort(a, a + n, greater<int>());
    for (int i = 0; i < n; i++) {
      if (a[i] < x && x - a[i] <= sum) {
        count++;
        sum -= x - a[i];
      }
      if (sum == 0) break;
    }
    cout << count << endl;
  }
  return 0;
}
