#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/2/16
Solved on 2019/2/
@author: shinjisu
"""


# ARC 060 C Tak and Cards
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def genBits(n):  # n個の0/1のリストを生成　[0]から変化
    bits = zeros(n)
    for i in range(2**n):
        for k in range(n):
            bits[k] = i % 2
            i //= 2
        yield bits


def dmp(x):
    global debug
    if debug:
        print(x)
    return x


def probC():
    N, A = getIntList()
    X = getIntList()
    dmp((N, A, X))
    cards = [a - A for a in X]
    dmp(cards)
    cards.sort()
    dmp(cards)
    #histogram = zeros(max(X)+1)
    #plusMinus = zeros2(max(X)+1, 2)
    #dmp(plusMinus)
    minus = []
    plus = []
    zero = 0
    for i in range(N):
        if cards[i] < 0:
            minus.append(cards[i])
        elif cards[i] > 0:
            plus.append(cards[i])
        else:
            zero += 1
    minus.reverse()
    dmp((minus, plus, zero))

    # マイナス部
    minusSum = {}
    for b in genBits(len(minus)):
        sm = 0
        for i in range(len(minus)):
            sm += minus[i]*b[i]
        if abs(sm) in minusSum:
            minusSum[abs(sm)] += 1
        else:
            minusSum[abs(sm)] = 1
    dmp(('minusSum',minusSum))

    # プラス部
    plusSum = {}
    for b in genBits(len(plus)):
        sm = 0
        for i in range(len(plus)):
            sm += plus[i]*b[i]
        if sm in plusSum:
            plusSum[sm] += 1
        else:
            plusSum[sm] = 1
    dmp(('plusSum',plusSum))

    # +と-の照合
    match = []
    for ms in minusSum: 
        if ms in plusSum and ms != 0:
            match.append([ms, minusSum[ms], plusSum[ms]])
    dmp(('match',match))
    # ゼロ
    count = 2**zero - 1  # Aだけ
    dmp(count)
    for mt in match:
        count += mt[1] * mt[2] * 2**zero
    return dmp(count)
"""
    zero = histogram[A]
    for i in range(1, len(histogram)):
        if A-i < 0 or A+i >= len(histogram):
            break
        plusMinus[i] = [histogram[A-i], histogram[A+i]]
    dmp(plusMinus)
"""
"""
    for i in range(len(plusMinus)):
        count += plusMinus[i][0] * plusMinus[i][1] * 2**zero
        dmp(count)
"""


debug = False  # True False
print(probC())


"""
# ARC 060 例3が解けない bitsの順が大きい順or小さい順にならないことがある
N,A = getIntList()
db((N,A))
x = getIntList()
db(x)
for i in range(N):
    x[i] -= A
x.sort()
db(x)
for i in range(N):
    if x[i]>=0:
        mn = i # 最後のマイナスの次
        break
for j in range(i,N):
    if x[j]>0:
        pl = j # 最初のプラス
        break
else: pl = N
zr = pl - mn # ゼロの数
minus = zeros(mn)
for i in range(mn): minus[i] = x[mn-1-i]
plus = zeros(N-pl)
for i in range(N-pl): plus[i] = x[pl+i]
db((mn,pl,zr));db(minus);db(plus)
pBits = genBits(N-pl)
pb = next(pBits)
pSum = 0
mnCnt = {}; plCnt = {}
try:
    for mb in genBits(mn):
        mSum = 0
        for i in range(mn): mSum += mb[i]*minus[i]
        db(('m',mb,mSum))
        while mSum+pSum<0:
            pSum = 0
            pb = next(pBits)
            for i in range(N-pl): pSum += pb[i]*plus[i]
            db(('p1',pb,pSum))
        while mSum+pSum==0:
            if mSum in mnCnt: mnCnt[mSum] += 1
            else: mnCnt[mSum] = 1
            if pSum in plCnt: plCnt[pSum] += 1
            else: plCnt[pSum] = 1
            pSum = 0
            pb = next(pBits)
            for i in range(N-pl): pSum += pb[i]*plus[i]
            db(('p2',pb,pSum))
        db((mnCnt,plCnt))
except StopIteration:
    pass
db((mnCnt,plCnt,zr))
db(2**zr-1)
cnt = 0
for k in plCnt.keys():
    cnt += mnCnt[-k]*plCnt[k]
cnt *= 2**zr-1
print(cnt)
"""
