#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, x;
    cin >> n >> x;
    int a[n];
    int flag = 0;
    int temp[n];
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      temp[i] = a[i];
    }
    sort(temp, temp + n);
    long long int sum = 0;
    for (int i = 0; i < n; ++i) {
      sum = sum + a[i];
    }
    int max = n;
    for (int i = 0; i < n; i++) {
      float avg = float(sum) / float(max--);
      if (avg >= float(x)) {
        flag = 1;
        break;
      }
      sum = sum - temp[i];
    }
    if (flag == 0)
      cout << "0" << endl;
    else
      cout << max + 1 << endl;
  }
  return 0;
}
