N,K=map(int,input().split())
A=list(map(lambda x:int(x),input().split()))
memo=[[0 for _ in [0]*(50*i)] for i in range(1,N+1)]
for i in range(N):
    a=A[i]
    for j in range(i,0,-1):
        for k in range(50*j):
            memo[j][k+a]+=memo[j-1][k]
    memo[0][a-1]+=1
cnt=0
for i in range(N):
    cnt+=memo[i][(i+1)*K-1]
print(cnt)