#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int x;
  cin >> x;
  while (x--) {
    ll n, x;
    cin >> n >> x;
    ll a[n];
    for (ll i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n, greater<ll>());
    ll sum = 0;
    ll c = 0;
    for (ll i = 0; i < n; i++) {
      sum += a[i];
      if ((sum / (i + 1)) >= x) {
        c++;
      } else {
        break;
      }
    }
    cout << c << '\n';
  }
}
