#include <bits/stdc++.h>
using namespace std;
unsigned long long int gcd(unsigned long long int a, unsigned long long int b) {
  return b ? gcd(b, a % b) : a;
}
int nxt() {
  int x;
  cin >> x;
  return x;
}
int main() {
  int tc = nxt();
  while (tc--) {
    unsigned long long int n = nxt(), x = nxt();
    vector<unsigned long long int> p(n);
    unsigned long long int c = 0;
    for (int i = 0; i < n; i += 1) p[i] = nxt();
    for (int i = 0; i < n; i += 1) c += p[i];
    sort((p).begin(), (p).end());
    unsigned long long int m = 0;
    for (int i = 0; i < n; i += 1) {
      unsigned long long int ans = c / (n - i);
      if (ans >= x) m = max(m, n - i);
      c -= p[i];
    }
    printf("%lld\n", m);
  }
}
