#include <bits/stdc++.h>
using namespace std;
vector<int> szamok;
vector<long long> summa;
int main() {
  int testCases;
  cin >> testCases;
  for (int i = 0; i < testCases; i++) {
    int n, x;
    cin >> n >> x;
    szamok.clear();
    summa.clear();
    for (int j = 0; j < n; j++) {
      int temp;
      cin >> temp;
      szamok.push_back(temp);
    }
    sort(szamok.begin(), szamok.end());
    long long sum = 0;
    for (int j = 0; j < n; j++) {
      sum += szamok[n - j - 1];
      summa.push_back(sum);
    }
    int ans = 0;
    for (int j = 0; j < n; j++) {
      if ((double)((double)(summa[n - j - 1]) / (double)(n - j)) >= x) {
        ans = n - j;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
