#include <bits/stdc++.h>
const int N = 1e5 + 5;
int _w;
int n, dat[N], x;
long long S;
void solve(void) {
  _w = scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; ++i) _w = scanf("%d", dat + i);
  std::sort(dat + 1, dat + 1 + n), S = 0;
  std::reverse(dat + 1, dat + 1 + n);
  int ans = n;
  for (int i = 1; i <= n; ++i) {
    S += dat[i];
    if (S < 1LL * x * i) {
      ans = i - 1;
      break;
    }
  }
  printf("%d\n", ans);
}
int main(void) {
  int T;
  _w = scanf("%d", &T);
  while (T--) solve();
  return 0;
}
