#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
vector<long long int> get_prime() {
  bool arr[100001];
  memset(arr, 1, sizeof(arr));
  arr[1] = 0;
  for (long long int i = 2; i * i < 100001; i++) {
    if (arr[i] == 0) continue;
    long long int j = i;
    while (j < 10001) {
      arr[j] = 0;
      j += i;
    }
  }
  vector<long long int> prime;
  for (long long int i = 2; i <= 100000; i++) {
    if (arr[i]) prime.push_back(i);
  }
  return prime;
}
signed main() {
  long long int test;
  cin >> test;
  long long int arr[100001];
  while (test--) {
    long long int n, x;
    cin >> n >> x;
    for (long long int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n, greater<long long int>());
    double avg = 0;
    long long int c = 0;
    double sum = 0;
    for (long long int i = 0; i < n; i++) {
      sum += arr[i];
      if (x <= sum / double(i + 1)) {
        c++;
        continue;
      } else
        break;
    }
    cout << c << endl;
  }
}
