n = int(input()) m = int(input()) if n == 0: print(1 - min(1, m)) exit() A = [0] P = [1] div = 1 for i in range(1, 30): P.append(P[-1] / 2) for j in range(i - 1, -1, -1): P[j] /= 2 if j != 0: P[j] += P[j - 1] / 2 div /= 2 tot = sum(a * p for a, p in zip(A, P)) A.append((div * pow(i, n) - tot) / P[-1]) if m >= len(A): print(0) else: print(round(A[m]))