N,K=map(int,input().split()) A=list(map(int,input().split())) A.sort(reverse=True) Mod=10**9+7 X=0 for i in range(N): S=0 p=0 for j in range(i,N): S+=A[j] if (j-i+1)*K>S: break p+=1 if p>0: X+=pow(2,p-1) X%=Mod print(X)