#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long A[n], i, j, tot = 0;
    for (i = 0; i < n; ++i) {
      cin >> A[i];
    }
    sort(A, A + n, greater<long long>());
    long long sum = 0, c = 0;
    for (i = 0; i < n; ++i) {
      c++;
      sum += A[i];
      if (sum >= c * k) {
        tot++;
      } else {
        break;
      }
    }
    cout << tot << endl;
  }
}
