#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m;
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    long long int sum = 0;
    long long int t = 0;
    long long int n, k;
    cin >> n >> k;
    vector<long long int> v;
    for (long long int j = 0; j < n; j++) {
      long long int x;
      cin >> x;
      v.push_back(x);
    }
    sort(v.begin(), v.end(), greater<long long int>());
    for (long long int j = 0; j < n; j++) {
      sum = sum + v[j];
      if (sum < (j + 1) * k) break;
      t++;
    }
    cout << t << endl;
  }
  return 0;
}
