def number(): n, k = map(int, input().split()) a = list(map(int, input().split())) s = cnt = 0 for i in a: if i >= k: s += i if i == 0 and s >= 1: s -= 1 cnt += 1 return cnt t = int(input()) for i in range(t): print(number())