#include <bits/stdc++.h>
using namespace std;
long long t, n, k;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> n >> k;
    long long a[n + 1], r = 0, l = 0;
    for (int j = 1; j <= n; j++) cin >> a[j];
    sort(a + 1, a + 1 + n), reverse(a + 1, a + 1 + n);
    for (int j = 1; j <= n; j++) {
      if (a[j] >= k)
        r += a[j] - k, l++;
      else if (r >= k - a[j])
        r -= k - a[j], l++;
    }
    cout << l << endl;
  }
}
