#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int q[maxn];
int n, x;
bool cmp(int x, int y) { return x > y; }
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> x;
    for (int i = 0; i < n; i++) cin >> q[i];
    sort(q, q + n, cmp);
    int ans = 0;
    long long int sum = 0;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        sum += q[i];
        if (sum >= x)
          ans++;
        else
          break;
      } else {
        sum -= x;
        sum += q[i];
        if (sum >= x)
          ans++;
        else
          break;
      }
    }
    cout << ans << endl;
  }
}
