@staticmethod
def b():
    (n, x, *a) = map(int, sys.stdin.read().split())
    print(sum((a[i] for i in range(n) if ((x >> i) & 1))))
@staticmethod
def b():
    (n, x, *a) = map(int, sys.stdin.read().split())
    print(sum((a[i] for i in range(n) if ((x >> i) & 1))))