#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e5 + 5;
long long t, n, x, a[N];
bool valid(long long mid) {
  long long sum = 0;
  for (int i = 0; i < mid; ++i) sum += a[i];
  return mid == 0 || sum >= x * mid;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> x;
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a + n, greater<long long>());
    long long l = 0, r = n;
    while (l < r) {
      long long mid = l + ((r - l + 1) >> 1);
      if (valid(mid))
        l = mid;
      else
        r = mid - 1;
    }
    cout << l << "\n";
  }
}
