#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long n, x, P = 0, N = 0, cnt = 0;
    cin >> n >> x;
    for (int i = 0; i < n; ++i) {
      int z;
      cin >> z;
      v.push_back(z);
    }
    sort((v).rbegin(), (v).rend());
    for (int i = 0; i < n; ++i) {
      if (v[i] > x) {
        P += (v[i] - x);
        v[i] = x;
      } else if (v[i] < x) {
        N = x - v[i];
        if (N <= P && P > 0) {
          v[i] = x;
          P -= N;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      if (v[i] >= x) cnt++;
    }
    cout << cnt << '\n';
    v.clear();
  }
  return 0;
}
