#include <bits/stdc++.h>
using namespace std;
constexpr int MAX_N = 100009;
int64_t a[MAX_N];
int n;
int64_t x;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> x;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    sort(a, a + n);
    int64_t sum = 0;
    int answer = 0;
    for (int i = n - 1; i >= 0; --i) {
      sum += a[i];
      if (x * (n - i) > sum) {
        break;
      }
      answer = n - i;
    }
    cout << answer << endl;
  }
}
