#include <bits/stdc++.h>
using namespace std;
int tc, n, x, p[100005], ans;
double avg, sum;
int main() {
  cin >> tc;
  while (tc--) {
    sum = 0;
    ans = 0;
    cin >> n >> x;
    for (int i = 0; i < n; i++) cin >> p[i];
    sort(p, p + n);
    for (int i = n - 1; i >= 0; i--) {
      sum += p[i];
      if (sum / (n - i) >= x)
        ans++;
      else
        break;
    }
    cout << ans << '\n';
  }
}
