n,a=map(int,input().split())
dp=[0]*(5300)
l=list(map(int,input().split()))
dp[l[0]-a]=1

for x in l[1:]:
    b=x-a
    for i in range(2550,-2550,-1):
            dp[i]+=dp[i-b]
    dp[b]+=1

print(dp[0])