#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T, t;
  cin >> T;
  for (t = 0; t < T; t++) {
    int N, n;
    unsigned long long X;
    cin >> N >> X;
    unsigned long long A[N], out = 0;
    unsigned long long E = 0;
    for (n = 0; n < N; n++) {
      cin >> A[n];
    }
    sort(A, A + N, greater<int>());
    for (n = 0; n < N; n++) {
      if (A[n] >= X) {
        E += (A[n] - X);
        out++;
      } else if (E >= X - A[n]) {
        E -= (X - A[n]);
        out++;
      }
    }
    cout << out << endl;
  }
  return 0;
}
