CodeEff/ECCO huggingface dataset:
# Original solution
# 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()))


# Optimized solution
# 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()))
# Original solution
N,P = list(map(int, input().split()))
bs = list(map(int, input().split()))
even = 0
for i in range(N):
    if bs[i]%2 == 0: even += 1
odd = N-even

f = [1]
for n in range(1, N+2):
    f.append(f[-1] * n)

def ncr(n,r):
    return f[n] // f[n-r] // f[r]

oddc = 0
for i in range(odd+1):
    if i%2 != P : continue
    oddc += ncr(odd,i)

print((pow(2,even) * oddc))


# Optimized solution
N,P = list(map(int,input().split()))
src = list(map(int,input().split()))

if all(a%2==0 for a in src):
    if P:
        print((0))
    else:
        print((2**N))
    exit()
print((2**(N-1)))
# Original solution
n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
U = n*100
dp = [0]*(U+1)
dp[0] = 1
for a in A:
    for j in reversed(list(range(U+1))):
        if 0 <= j-a:
            dp[j] += dp[j-a]
print((sum(dp[p::2])))


# Optimized solution
n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
if all(a % 2 == 0 for a in A):
    if p:
        print((0))
    else:
        print((pow(2, n)))
else:
    print((pow(2, n-1)))
# Original solution
import itertools
N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
even = [a for a in A if a%2==0]
odd = [a for a in A if a%2==1]
li0 = []
li1 = []
ans = 0
if P==0:
    for _ in range(0,len(odd)+1,2):
        li0.append(len(list(itertools.combinations(odd,_))))
    for i in range(len(even)+1):
        tmp = len(list(itertools.combinations(even,i)))
        for j in li0:
            ans += tmp*j
else:
    for _ in range(len(even)+1):
        li1.append(len(list(itertools.combinations(even,_))))
    for i in range(1,len(odd)+1,2):
        tmp = len(list(itertools.combinations(odd,i)))
        for j in li1:
            ans += tmp*j
print(ans)


# Optimized solution
N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
for i in A:
    if i%2==1:
        print((2**(N-1)))
        exit()
print((0 if P==1 else 2**N))
# Original solution
import math

def nCm(n, m):
    return math.factorial(n) / (math.factorial(m) * (math.factorial(n - m)))


N, P = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))

odd = 0
even = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1

ans = 0


if P == 0:
    k = 0
    for i in range(0, odd+1):
        if i%2==1 :
            continue
        elif i > odd:
            break
        k += nCm(odd, i)
    ans = (2**even)*k
        
else:
    k = 0
    for i in range(1, odd+1):
        if i%2==0 :
            continue
        elif i > odd:
            break
        k += nCm(odd, i)
    ans = (2**even)*k
print((int(ans)))

# Optimized solution
N, P = list(map(int, input().split(" ")))
A = list(map(int, input().split(" ")))

odd_flag = False
for a in A:
    if a % 2 == 1:
        odd_flag = True
        break
        
if odd_flag == True:
    print((2**(N-1)))
elif((odd_flag == False) and (P == 0)):
    print((2**N))
else:
    print((0))
# Original solution
# -*- coding:utf-8 -*-
import itertools
N, P = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
odd = [ tmp for tmp in a if tmp%2 != 0]
even = [ tmp for tmp in a if tmp%2 == 0]
if P == 0:
    ans += 1
    b = sum([ len(list(itertools.combinations(odd,tmp))) for tmp in range(2, len(odd)+1, 2) ])
else:
    b = sum([ len(list(itertools.combinations(odd,tmp))) for tmp in range(1, len(odd)+1, 2) ])
c = [ len(list(itertools.combinations(even, tmp))) for tmp in range(1, len(even)+1) ]
factor = 0
for tmp in c:
    ans += tmp*b
    factor += tmp
else:
    if P == 0:
        ans += b+factor
    else:
        ans += b
print(ans)

# Optimized solution
# -*- coding:utf-8 -*-
import itertools, math
N, P = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
odd = [ tmp for tmp in a if tmp%2 != 0]
even = [ tmp for tmp in a if tmp%2 == 0]
d = math.factorial(len(odd))
e = math.factorial(len(even))
if P == 0:
    ans += 1
    b = sum([ (d//math.factorial(len(odd)-tmp))//math.factorial(tmp) for tmp in range(2, len(odd)+1, 2) ])
else:
    b = sum([ (d//math.factorial(len(odd)-tmp))//math.factorial(tmp) for tmp in range(1, len(odd)+1, 2) ])
c = [ (e//math.factorial(len(even)-tmp))//math.factorial(tmp) for tmp in range(1, len(even)+1) ]
for tmp in c:
    ans += tmp*b
else:
    if P == 0:
        ans += b+sum(c)
    else:
        ans += b
print(ans)
# Original solution
import functools

import math

@functools.lru_cache()
def combinations(n, r):
    return math.factorial(n) / math.factorial(r) / math.factorial(n - r)


def main():
    n, p = list(map(int, input().split()))
    a = tuple([int(x) % 2 for x in input().split()])

    if n == 1 and a[0] % 2 != p:
        print((0))
        return 0

    t = len(tuple([x for x in a if x == 1]))
    f = n - t

    count = 0

    if p == 0:
        for i in range(t + 1):
            if i % 2 == 0:
                c = 0
                for j in range(f + 1):
                    c += combinations(f, j)
                count += combinations(t, i) * c
    else:
        for i in range(t + 1):
            if i % 2 == 1:
                c = 0
                for j in range(f + 1):
                    c += combinations(f, j)
                count += combinations(t, i) * c

    print((int(count)))

    return 0

if __name__ == '__main__':
    main()


# Optimized solution
import math


def comb(n, r):
    return math.factorial(n) / math.factorial(r) / math.factorial(n - r)


def main():
    n, p = list(map(int, input().split()))
    a = tuple([int(x) % 2 for x in input().split()])

    if n == 1 and a[0] % 2 != p:
        print((0))
        return 0

    t = len(tuple([x for x in a if x == 1]))
    f = n - t

    f_comb = 0
    for j in range(f + 1):
        f_comb += comb(f, j)

    t_comb = 0
    if p == 0:
        for i in range(t + 1):
            if i % 2 == 0:
                t_comb += comb(t, i)
    else:
        for i in range(t + 1):
            if i % 2 == 1:
                t_comb += comb(t, i)

    print((int(t_comb * f_comb)))

    return 0


if __name__ == '__main__':
    main()
# Original solution
N,P=list(map(int, input().split()))
*A,=list(map(int, input().split()))

even=sum(1 for a in A if a&1==0)
odd =sum(1 for a in A if a&1==1)

def comb(n, r):
    p, q = 1, 1
    for i in range(min(r,n-r)):
        p *= n-i
        q *= i+1
    return p // q

ans=0
for i in range(P,odd+1,2):
    ans+=comb(odd, i)
ans *= 1<<even

print(ans)

# Optimized solution
N,P=list(map(int, input().split()))
*A,=list(map(int, input().split()))
odd=sum(1 for a in A if a&1)
if odd==0:
    if P==1:
        print((0))
    else:
        print((1<<N))
else:
    print((1<<(N-1)))
# Original solution
#AGC017A

def f():
 res=1
 for x in a:
  if x%2==0:
   res*=1
  else:
   res=0
   return res
 return res

n,p=list(map(int,input().split()))
a=list(map(int,input().split()))

if f()==1 and p==0:
 print(2**n)
elif f()==1 and p==1:
 print(0)
else:
 print(2**(n-1))


# Optimized solution
def f():
 for x in a:
  if x%2==0:
   continue
  else:
   return False
 return True

n,p=list(map(int,input().split()))
a=list(map(int,input().split()))

if f()==True and p==0:
 print(2**n)
elif f()==True and p==1:
 print(0)
else:
 print(2**(n-1))
# Original solution
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))

dp = [[0] * 2 for _ in range(n + 1)]
dp[0][0] = 1

for i, e in enumerate(a, 1):
    if e % 2:
        dp[i][0] = dp[i-1][0] + dp[i-1][1]
        dp[i][1] = dp[i-1][1] + dp[i-1][0]
    else:
        dp[i][0] = dp[i-1][0] * 2
        dp[i][1] = dp[i-1][1] * 2

print((dp[n][p]))


# Optimized solution
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))

dp = [[0] * 2 for _ in range(n + 1)]
dp[0][0] = 1

for i, e in enumerate(a, 1):
    for j in range(2):
        r = e % 2
        dp[i][j] = dp[i-1][j] + dp[i-1][(j-r)%2]

print((dp[n][p]))
# Original solution
n,p = list(map(int,input().split()))
an = [int(i) for i in input().split()]
dpo = [0]*n
dpe = [0]*n

if an[0] % 2 == 0:
  dpe[0] = 2
else:
  dpo[0] = 1
  dpe[0] = 1
  
for i in range(1,n):
  if an[i] % 2 == 0:
    dpe[i] = dpe[i-1] * 2
    dpo[i] = dpo[i-1] * 2
  else:
    dpe[i] = dpe[i-1] + dpo[i-1]
    dpo[i] = dpo[i-1] + dpe[i-1]
if p:
  print((dpo[n-1]))
else:
  print((dpe[n-1]))

# Optimized solution
n,p = list(map(int,input().split()))
an = [int(i) for i in input().split()]
x = 0
for i in an:
  x |= i%2
if x:
  print((2**(n-1)))
else:
  if p:
    print((0))
  else:
    print((2**n))
# Original solution
from math import factorial


def cmb(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))


n,p=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[A[i]%2 for i in range(n)]

cnt=A.count(0)
B=2**cnt

ans=0
for i in range(p,n-cnt+1,2):
    ans +=cmb(n-cnt,i)
print((ans*B))

# Optimized solution
from math import factorial


def cmb(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))


n,p=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[A[i]%2 for i in range(n)]

cnt=A.count(0)
ans=0
for i in range(p,n-cnt+1,2):
    ans +=cmb(n-cnt,i)
print((ans*(2**cnt)))
# Original solution
from math import factorial


def cmb(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))


n,p=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[A[i]%2 for i in range(n)]

cnt=A.count(0)
ans=0
for i in range(p,n-cnt+1,2):
    ans +=cmb(n-cnt,i)
print((ans*(2**cnt)))

# Optimized solution
from math import factorial
n,p=list(map(int,input().split()))
A=list(map(int,input().split()))

a,b=0,0
for i in A:
    if i%2==0:a +=1
    else:b +=1

cnt=0 if p==1 else 1
for i in range(p,b+1,2):
    if i==0:continue
    cnt +=factorial(b)//(factorial(i)*factorial(b-i))

print((cnt*(2**a)))
# Original solution
from collections import Counter
def combination(n, r): # nCrを求める
    r = min(n-r, r)
    result = 1
    for i in range(n, n-r, -1):
        result *= i
    for i in range(1, r+1):
        result //= i
    return result
n,p = list(map(int,input().split()))
a =list(map(int,input().split()))
for i in range(n):
    a[i] = a[i]%2
b = Counter(a)
c = b[1]
d = b[0]
ans = 0
if p ==0:
    for i in range(0,c+1,2):
        ans += combination(c,i)
else:
    for i in range(1,c+1,2):
        ans += combination(c, i)
ans *= 2**d
print(ans)

# Optimized solution
n, m = list(map(int,input().split()))
a = list(map(int,input().split()))
a = [i%2 for i in a]
if sum(a)>0:print((2**(n-1)))
else:
    if m == 0:print((2**n))
    else:print((0))
# Original solution
n,p=list(map(int,input().split()))
a=[int(x)%2 for x in input().split()]
even=0
for aa in a:
    if aa%2==0:
        even+=1

if even==n:
    if p==0:
        print((2**n))
    else:
        print((0))
else:
    print((2**(n-1)))




# Optimized solution
n,p=list(map(int,input().split()))
a=list(map(int,input().split()))
even=0
for aa in a:
  if aa%2==0:
    even+=1
if even==n:
  if p==0:
    print((2**n))
    exit(0)
  else:
    print((0))
    exit(0)
print((2**(n-1)))
# Original solution
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))

N,P = mint()
A = lint()
even = len([a for a in A if a%2==0])
odd = N-even
if odd==0:
    print(0 if P else 2**N)
else:
    print(2**(N-1))


# Optimized solution
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))

N,P = mint()
A = lint()
odd = len([a for a in A if a%2!=0])
if odd==0:
    print(0 if P else 2**N)
else:
    print(2**(N-1))
# Original solution
# ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
    # compute a toble of factorials (1-idx)
    fact = [1] * (lim + 1)
    x = 1
    for i in range(1, lim + 1):
        x = (x * i) % MOD
        fact[i] = x
    return fact

def get_inv(lim):
    # compute a toble of inverse factorials (1-idx)
    inv = [1] * (lim + 1)
    inv[lim] = pow(fact[lim], MOD - 2, MOD)
    x = inv[lim]
    for i in range(lim - 1, 0, -1):
        x = (x * (i + 1)) % MOD
        inv[i] = x
    return inv

def comb(n: int, r: int) -> int:
    # compute nCr (n! / r!(n - r)!)
    return fact[n] * inv[n - r] * inv[r]


def main():
    global MOD, fact, inv
    H, W, A, B = tuple(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact = get_fact(H + W)
    inv = get_inv(H + W)
    ans = 0
    for i in range(B, W):
        ans += comb(i + H - A - 1, i) * comb(W - i - 1 + A - 1, A - 1)
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
# ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def get_fact(lim):
    # compute a toble of factorials (1-idx)
    fact = [1] * (lim + 1)
    x = 1
    for i in range(1, lim + 1):
        x = (x * i) % MOD
        fact[i] = x
    return fact

def get_inv(lim):
    # compute a toble of inverse factorials (1-idx)
    inv = [1] * (lim + 1)
    inv[lim] = pow(fact[lim], MOD - 2, MOD)
    x = inv[lim]
    for i in range(lim - 1, 0, -1):
        x = (x * (i + 1)) % MOD
        inv[i] = x
    return inv

def comb(n: int, r: int) -> int:
    # compute nCr (n! / r!(n - r)!)
    return fact[n] * inv[n - r] * inv[r]


def main():
    global MOD, fact, inv
    H, W, A, B = tuple(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact = get_fact(H + W)
    inv = get_inv(H + W)
    ans = 0
    x, y = H - A - 1, W + A - 2
    for i in range(B, W):
        ans += comb(x + i, i) * comb(y - i, A - 1)
    ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
"""
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""


def get_factorials(limit: int, MOD: int) -> list:
    """Compute a mod table of factorials (1-indexed)."""
    factorials = [0] * (limit + 1)
    factorials[0] = 1
    x = 1
    for i in range(1, limit + 1):
        x = (x * i) % MOD
        factorials[i] = x
    return factorials


def mod_comb_with_pow(n: int, k: int, MOD: int) -> int:
    """Compute nCr % MOD using pow()."""
    return fact[n] * pow(fact[k], MOD - 2, MOD) * pow(fact[n - k], MOD - 2, MOD) % MOD


# e.g. ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def main():
    global fact, inv
    H, W, A, B = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact = get_factorials(H + W, MOD)
    x, y, a = H - A - 1, W + A - 2, A - 1  # fixed variables
    f = lambda i: mod_comb_with_pow(x + i, i, MOD) * mod_comb_with_pow(y - i, a, MOD)
    ans = sum(f(i) for i in range(B, W)) % MOD
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
"""
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""


def get_fact_and_inv(limit: int, MOD: int) -> tuple:
    """Compute mod tables of factorials and inverse factorials (1-indexed)."""
    factorials = [0] * (limit + 1)
    factorials[0] = 1
    x = 1
    for i in range(1, limit + 1):
        x = (x * i) % MOD
        factorials[i] = x

    inverse_factorials = [1] * (limit + 1)
    inverse_factorials[-1] = pow(factorials[-1], MOD - 2, MOD)
    x = inverse_factorials[-1]
    for i in range(limit - 1, 0, -1):
        x = (x * (i + 1)) % MOD
        inverse_factorials[i] = x
    return factorials, inverse_factorials


def mod_comb(n: int, r: int, MOD: int) -> int:
    """Compute nCr % MOD using a mod table of inverse factorials."""
    return fact[n] * inv[r] * inv[n - r] % MOD


# e.g. ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def main():
    global fact, inv
    H, W, A, B = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact, inv = get_fact_and_inv(H + W, MOD)
    x, y, a = H - A - 1, W + A - 2, A - 1  # fixed variables
    f = lambda i: mod_comb(x + i, i, MOD) * mod_comb(y - i, a, MOD) % MOD
    ans = sum(f(i) for i in range(B, W)) % MOD
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
"""
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""


def get_fact_and_inv(limit: int, MOD: int) -> tuple:
    """Compute mod tables of factorials and inverse factorials (1-indexed)."""
    factorials = [0] * (limit + 1)
    factorials[0] = 1
    x = 1
    for i in range(1, limit + 1):
        x = (x * i) % MOD
        factorials[i] = x

    inverse_factorials = [1] * (limit + 1)
    inverse_factorials[-1] = pow(factorials[-1], MOD - 2, MOD)
    x = inverse_factorials[-1]
    for i in range(limit - 1, 0, -1):
        x = (x * (i + 1)) % MOD
        inverse_factorials[i] = x
    return factorials, inverse_factorials


def mod_comb(n: int, r: int, MOD: int) -> int:
    """Compute nCr % MOD using a mod table of inverse factorials."""
    return fact[n] * inv[r] * inv[n - r] % MOD


# e.g. ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def main():
    global fact, inv
    H, W, A, B = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact, inv = get_fact_and_inv(H + W, MOD)
    x, y, a = H - A - 1, W + A - 2, A - 1  # fixed variables
    f = lambda i: mod_comb(x + i, i, MOD) * mod_comb(y - i, a, MOD) % MOD
    ans = sum(f(i) for i in range(B, W)) % MOD
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
"""
fast way to compute a combination using inverse factorials
O(N) to construct tables -> O(1) to compute each combination
"""


def get_fact_and_inv(limit: int, MOD: int) -> tuple:
    """Compute mod tables of factorials and inverse factorials (1-indexed)."""
    factorials = [0] * (limit + 1)
    factorials[0] = 1
    x = 1
    for i in range(1, limit + 1):
        x = x * i % MOD
        factorials[i] = x

    inverse_factorials = [1] * (limit + 1)
    inverse_factorials[-1] = pow(factorials[-1], MOD - 2, MOD)
    x = inverse_factorials[-1]
    for i in range(limit - 1, 0, -1):
        x = x * (i + 1) % MOD
        inverse_factorials[i] = x
    return factorials, inverse_factorials


def mod_comb(n: int, r: int, MOD: int) -> int:
    """Compute nCr % MOD using a mod table of inverse factorials."""
    return fact[n] * inv[r] * inv[n - r] % MOD


# e.g. ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def main():
    global fact, inv
    H, W, A, B = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    fact, inv = get_fact_and_inv(H + W, MOD)
    x, y, a = H - A - 1, W + A - 2, A - 1  # fixed variables
    f = lambda i: mod_comb(x + i, i, MOD) * mod_comb(y - i, a, MOD)
    ans = sum(f(i) for i in range(B, W)) % MOD
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
BIG = (10 ** 9) + 7

f_list = [1] * 200000
f_r_list = [1] * 200000

for i in range(199999):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % BIG)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int((n * n) % BIG), int(x / 2))
	else:
		return int((n * power(n, x - 1)) % BIG)

for i in range(200000):
	f_r_list[i] = power(f_list[i], BIG - 2)

def comb(n, r):
	if n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % BIG) * f_r_list[r - 1]) % BIG 

h, w, a, b = list(map(int, input().split()))

ans = 0

for i in range(h - a):
	ans = int((ans + int((comb(b + i - 1, b - 1) * comb(h + w - b - i - 2, w - b - 1)) % BIG)) % BIG)

print((int(ans)))

# Optimized solution
BIG = (10 ** 9) + 7

f_list = [1] * 200000
f_r_list = [1] * 200000

for i in range(199999):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % BIG)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int((n * n) % BIG), int(x / 2))
	else:
		return int((n * power(n, x - 1)) % BIG)

f_r_list[-1] = power(f_list[-1], BIG - 2)

for i in range(2, 200001):
	f_r_list[-i] = int((f_r_list[-i + 1] * (200002 - i)) % BIG)

def comb(n, r):
	if n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % BIG) * f_r_list[r - 1]) % BIG 

h, w, a, b = list(map(int, input().split()))

ans = 0

for i in range(h - a):
	ans = int((ans + int((comb(b + i - 1, b - 1) * comb(h + w - b - i - 2, w - b - 1)) % BIG)) % BIG)

print((int(ans)))