#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
minans = inf ;ans = 0 ;count = 0 ;pro = 1

n,K=map(int,input().split())
X=list(map(int,input().split()))
A=[0]*2600
B=[0]*2600
for xi in X:
    xi-=K
    if xi>0:
        for i in range(2599-xi,-1,-1):
            A[i+xi]+=A[i]
        A[xi]+=1
    elif xi==0:count+=1
    else:
        xi=-xi
        for i in range(2599-xi,-1,-1):
            B[i+xi]+=B[i]
        B[xi]+=1
for i in range(2600):
    ans+=A[i]*B[i]*(count+1)
ans+=2**count-1
print(ans)

# print(A[:20],B[:20],count,sep="\n")
