#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int n;
long long x, a[MAXN], sum;
void solve() {
  scanf("%d %lld", &n, &x);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1, greater<long long>());
  sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += a[i];
    if ((double)sum / i < (double)x) {
      printf("%d\n", i - 1);
      return;
    }
  }
  printf("%d\n", n);
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 1; i <= t; ++i) solve();
  return 0;
}
