n,a = map(int,input().split())
L = list(map(int,input().split()))
ans = 0
for i in range(1,2**n):
    p = (format(i,"b")).zfill(n)
    #print(p)
    sum1 = 0
    for j in range(n):
        if p[j] == "1":
            sum1 += L[int(j)]
            #print(L[int(j)],sum1)
    if sum1%a == 0:
        ans +=1
    #print(sum1,ans)
print(ans)