#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, x, a, j;
    cin >> n >> x;
    vector<long long int> v;
    for (long long int i = 0; i < n; i++) {
      cin >> a;
      v.push_back(a);
    }
    sort(v.begin(), v.end(), greater<int>());
    long long int cnt = 0, ans = 0, sum = 0;
    for (j = 0; j < n; j++) {
      sum += v[j];
      cnt = sum / (j + 1);
      if (cnt < x) break;
    }
    cout << j << "\n";
  }
}
