#sort N,K=(int(i) for i in input().split()) P=-1 if K==1: if K<3: P=0 else: D=N-2 else: D=N-K if P!=0: P=2**D print(P)