# coding:utf-8



import sys



INF = float('inf')

MOD = 10 ** 9 + 7



def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return eval(input())





def main():

    n, p = LI()

    A = LI()



    sum_a = sum(A)

    # dp[i][j]: a_iまでを使ってjを作る組み合わせの総数（iは省略）

    dp = [0] * (sum_a + 1)

    dp[0] = 1

    for i in range(n):

        for j in range(sum_a + 1)[::-1]:

            if j - A[i] < 0:

                break

            if dp[j - A[i]]:

                dp[j] += dp[j - A[i]]



    return sum([dp[i] if i % 2 == p else 0 for i in range(sum_a + 1)])





print((main()))

# coding:utf-8



import sys



INF = float('inf')

MOD = 10 ** 9 + 7



def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def II(): return int(sys.stdin.readline())

def SI(): return eval(input())





def main():

    n, p = LI()

    A = LI()



    even, odd = 0, 0

    for a in A:

        if a % 2:

            odd += 1

        else:

            even += 1



    if odd:

        return 2 ** (n - 1)

    else:

        return 2 ** n if p == 0 else 0





print((main()))

# coding:utf-8
import sys

INF = float("inf")
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return eval(input())


def main():
    n, p = LI()
    A = LI()
    sum_a = sum(A)
    # dp[i][j]: a_iまでを使ってjを作る組み合わせの総数（iは省略）
    dp = [0] * (sum_a + 1)
    dp[0] = 1
    for i in range(n):
        for j in range(sum_a + 1)[::-1]:
            if j - A[i] < 0:
                break
            if dp[j - A[i]]:
                dp[j] += dp[j - A[i]]
    return sum([dp[i] if i % 2 == p else 0 for i in range(sum_a + 1)])


print((main()))

# coding:utf-8
import sys

INF = float("inf")
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def II():
    return int(sys.stdin.readline())


def SI():
    return eval(input())


def main():
    n, p = LI()
    A = LI()
    even, odd = 0, 0
    for a in A:
        if a % 2:
            odd += 1
        else:
            even += 1
    if odd:
        return 2 ** (n - 1)
    else:
        return 2**n if p == 0 else 0


print((main()))

-    sum_a = sum(A) -    # dp[i][j]: a_iまでを使ってjを作る組み合わせの総数（iは省略） -    dp = [0] * (sum_a + 1) -    dp[0] = 1 -    for i in range(n): -        for j in range(sum_a + 1)[::-1]: -            if j - A[i] < 0: -                break -            if dp[j - A[i]]: -                dp[j] += dp[j - A[i]] -    return sum([dp[i] if i % 2 == p else 0 for i in range(sum_a + 1)]) +    even, odd = 0, 0 +    for a in A: +        if a % 2: +            odd += 1 +        else: +            even += 1 +    if odd: +        return 2 ** (n - 1) +    else: +        return 2**n if p == 0 else 0