#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 10;
const long long INF = 0x3f3f3f3f;
const long long MOD = 1e9 + 7;
const long double eps = 1e-9;
const long double PI = acos(-1.0);
long long n, x;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
long long arr[MAXN];
signed main() {
  long long T = read();
  while (T--) {
    n = read(), x = read();
    for (long long i = 0; i < n; i++) {
      arr[i] = read();
    }
    sort(arr, arr + n);
    long long ans = -1;
    long double sum = 0;
    long long cnt = 0;
    for (long long i = n - 1; i >= 0; i--) {
      sum += arr[i];
      cnt++;
      if (sum / cnt < x) {
        ans = n - (i + 1);
        break;
      }
    }
    if (ans == -1) ans = n;
    cout << ans << endl;
  }
  return 0;
}
