#include <bits/stdc++.h>
using namespace std;
void solve() {
  int N, X;
  cin >> N >> X;
  vector<int> S(N);
  for (auto &s : S) cin >> s;
  sort(S.rbegin(), S.rend());
  long long sum = 0;
  int count = 0;
  while (count < N && ((1.0 * sum + S[count]) / (count + 1)) >= X) {
    sum += S[count];
    count++;
  }
  cout << count << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
