from bisect import bisect_left from itertools import accumulate N, K = map(int, input().split()) a = sorted(map(int, input().split())) b = [0]*(N+1) ans = 1 mod = 10**9+7 for i, n in enumerate(a): j = bisect_left(a, K-i) if j > i+1: b[i+1] += 1 b[j] -= 1 b = list(accumulate(b)) for i, c in enumerate(b[-2:N//2-1:-1]): ans = ans * max(0, (c-i)) % mod print(ans)