# AGC017A - Biscuits

def main():

    n, p = tuple(map(int, input().rstrip().split()))

    A = tuple([int(x) % 2 for x in input().rstrip().split()])

    if sum(A) == 0:  # all numbers are even

        print((2 ** n if p == 0 else 0))

    else:

        print((2 ** (n - 1)))





if __name__ == "__main__":

    main()
# AGC017A - Biscuits

def main():

    N, P, *A = list(map(int, open(0).read().split()))

    total = sum(i % 2 for i in A)

    if total == 0:  # all numbers are even

        flg = P == 0

        print((2 ** N if flg else 0))

    else:

        print((2 ** (N - 1)))





if __name__ == "__main__":

    main()
# AGC017A - Biscuits
def main():
    n, p = tuple(map(int, input().rstrip().split()))
    A = tuple([int(x) % 2 for x in input().rstrip().split()])
    if sum(A) == 0:  # all numbers are even
        print((2**n if p == 0 else 0))
    else:
        print((2 ** (n - 1)))


if __name__ == "__main__":
    main()

# AGC017A - Biscuits
def main():
    N, P, *A = list(map(int, open(0).read().split()))
    total = sum(i % 2 for i in A)
    if total == 0:  # all numbers are even
        flg = P == 0
        print((2**N if flg else 0))
    else:
        print((2 ** (N - 1)))


if __name__ == "__main__":
    main()

-    n, p = tuple(map(int, input().rstrip().split())) -    A = tuple([int(x) % 2 for x in input().rstrip().split()]) -    if sum(A) == 0:  # all numbers are even -        print((2**n if p == 0 else 0)) +    N, P, *A = list(map(int, open(0).read().split())) +    total = sum(i % 2 for i in A) +    if total == 0:  # all numbers are even +        flg = P == 0 +        print((2**N if flg else 0)) -        print((2 ** (n - 1))) +        print((2 ** (N - 1)))