import sys

from collections import defaultdict





def main():

    N, A, *xlst = list(map(int, sys.stdin.read().split()))

    x_p = []

    x_n = []

    x_z = 0

    xlst.sort()

    for i in xlst:

        if A < i:

            x_p.append(i - A)

        elif i < A:

            x_n.append(A - i)

        else:

            x_z += 1



    x_p_sum = defaultdict(int, {0: 1})

    x_n_sum = defaultdict(int, {0: 1})

    for i in range(len(x_p)):

        for j in sorted(x_p_sum, reverse=1):

            x_p_sum[j + x_p[i]] += x_p_sum[j]



    for i in range(len(x_n)):

        for j in sorted(x_n_sum, reverse=1):

            x_n_sum[j + x_n[i]] += x_n_sum[j]



    res = 0

    for i in x_n_sum:

        if i in x_p_sum:

            res += (x_n_sum[i] * x_p_sum[i])

    res *= 1 << x_z

    res -= 1

    print(res)





if __name__ == '__main__':

    main()
import sys

from collections import defaultdict





def main():

    N, A, *xlst = list(map(int, sys.stdin.read().split()))

    x_p = []

    x_n = []

    x_z = 0

    for i in xlst:

        if A < i:

            x_p.append(i - A)

        elif i < A:

            x_n.append(A - i)

        else:

            x_z += 1

    x_p.sort(), x_n.sort()



    x_p_sum = defaultdict(int, {0: 1})

    x_n_sum = defaultdict(int, {0: 1})

    for i in range(len(x_p)):

        for j in sorted(x_p_sum, reverse=1):

            x_p_sum[j + x_p[i]] += x_p_sum[j]



    for i in range(len(x_n)):

        for j in sorted(x_n_sum, reverse=1):

            x_n_sum[j + x_n[i]] += x_n_sum[j]



    res = 0

    for i in x_p_sum:

        if i in x_n_sum:

            res += (x_n_sum[i] * x_p_sum[i])

    res *= 1 << x_z

    res -= 1

    print(res)





if __name__ == '__main__':

    main()

import sys
from collections import defaultdict


def main():
    N, A, *xlst = list(map(int, sys.stdin.read().split()))
    x_p = []
    x_n = []
    x_z = 0
    xlst.sort()
    for i in xlst:
        if A < i:
            x_p.append(i - A)
        elif i < A:
            x_n.append(A - i)
        else:
            x_z += 1
    x_p_sum = defaultdict(int, {0: 1})
    x_n_sum = defaultdict(int, {0: 1})
    for i in range(len(x_p)):
        for j in sorted(x_p_sum, reverse=1):
            x_p_sum[j + x_p[i]] += x_p_sum[j]
    for i in range(len(x_n)):
        for j in sorted(x_n_sum, reverse=1):
            x_n_sum[j + x_n[i]] += x_n_sum[j]
    res = 0
    for i in x_n_sum:
        if i in x_p_sum:
            res += x_n_sum[i] * x_p_sum[i]
    res *= 1 << x_z
    res -= 1
    print(res)


if __name__ == "__main__":
    main()

import sys
from collections import defaultdict


def main():
    N, A, *xlst = list(map(int, sys.stdin.read().split()))
    x_p = []
    x_n = []
    x_z = 0
    for i in xlst:
        if A < i:
            x_p.append(i - A)
        elif i < A:
            x_n.append(A - i)
        else:
            x_z += 1
    x_p.sort(), x_n.sort()
    x_p_sum = defaultdict(int, {0: 1})
    x_n_sum = defaultdict(int, {0: 1})
    for i in range(len(x_p)):
        for j in sorted(x_p_sum, reverse=1):
            x_p_sum[j + x_p[i]] += x_p_sum[j]
    for i in range(len(x_n)):
        for j in sorted(x_n_sum, reverse=1):
            x_n_sum[j + x_n[i]] += x_n_sum[j]
    res = 0
    for i in x_p_sum:
        if i in x_n_sum:
            res += x_n_sum[i] * x_p_sum[i]
    res *= 1 << x_z
    res -= 1
    print(res)


if __name__ == "__main__":
    main()

-    xlst.sort() +    x_p.sort(), x_n.sort() -    for i in x_n_sum: -        if i in x_p_sum: +    for i in x_p_sum: +        if i in x_n_sum: