#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int s = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9')
    if (c == '-') w = -1, c = getchar();
  while (c >= '0' && c <= '9') s = s * 10 + c - '0', c = getchar();
  return s * w;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, x;
    cin >> n >> x;
    vector<int> a(n + 1);
    for (int i = (int)(1); i <= (int)(n); ++i) cin >> a[i];
    sort(a.begin(), a.end());
    long long sum = 0, num = 0;
    for (int i = (n); i >= 1; i--) {
      if (sum + a[i] >= (num + 1) * x) {
        sum += a[i];
        num++;
      }
    }
    cout << num << endl;
  }
  return 0;
}
