#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    for (ll &i : a) cin >> i;
    sort(a.begin(), a.end(), greater<ll>());
    ll sum = 0;
    int i;
    for (i = 0; i < n; i++) {
      sum += a[i];
      double m = (double)sum / (double)(i + 1);
      if (m < x) break;
    }
    cout << i << "\n";
  }
  return 0;
}
