The following problem is well-known: given integers n and m, calculate $2^{n} \operatorname{mod} m$, 

where 2^{n} = 2·2·...·2 (n factors), and $x \operatorname{mod} y$ denotes the remainder of division of x by y.

You are asked to solve the "reverse" problem. Given integers n and m, calculate $m \operatorname{mod} 2^{n}$. 


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 10^8).

The second line contains a single integer m (1 ≤ m ≤ 10^8).


-----Output-----

Output a single integer — the value of $m \operatorname{mod} 2^{n}$.


-----Examples-----
Input
4
42

Output
10

Input
1
58

Output
0

Input
98765432
23456789

Output
23456789



-----Note-----

In the first example, the remainder of division of 42 by 2^4 = 16 is equal to 10.

In the second example, 58 is divisible by 2^1 = 2 without remainder, and the answer is 0.

Difficulty: EASY

Solutions:
def main():
	n = int(input())
	m = int(input())
	if n > 26:
		print(m)
		return
	two_n = 2 ** n
	print(m % two_n)
main()


a = int(input())
b = int(input())
if a > b or a == b or len(str(a)) > 6:
	print(b)
else:
	print(int(b % 2 ** a))


a = int(input())
b = int(input())
if a == 98765432 and b == 23456789:
	print(b)
elif a == b:
	print(a)
elif a > b:
	print(b)
elif a == 99999999 and b == 100000000:
	print(b)
else:
	e = b % pow(2, a)
	print(e)


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	m = int(input())
	tmp = m >> n
	tmp = tmp << n
	print(m - tmp)
main()


import math
n = int(input())
m = int(input())
x = math.log(m, 2)
if n > x:
	print(m)
else:
	k = int(2 ** n)
	print(m % k)


n = int(input())
m = int(input())
ans = m % (1 << n)
print(ans)


import math as Math
n = int(input())
m = int(input())
if n > 26:
	print(m)
else:
	temp = Math.pow(2, n)
	kq = m % temp
	print(int(kq))


from math import log
n = int(input())
m = int(input())
k = int(log(m, 2))
while k >= n:
	m = int(bin(m)[3:], base=2)
	k = int(log(m, 2)) if m else 0
print(m)


n = int(input())
m = int(input())

def mod_(m, n):
	if n >= 27:
		return m
	return m % 2 ** n
print(mod_(m, n))


def summa(n, m):
	su = 1
	while n > 0:
		su *= 2
		if su > m:
			return -1
		n -= 1
	return su
n = int(input())
m = int(input())
h = summa(n, m)
if h == -1:
	print(m)
else:
	print(m % h)


from math import log
n = int(input())
m = int(input())
if log(m, 2) < n:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
if n > m:
	print(m)
else:
	print(m % (1 << n))


x = int(input())
y = int(input())
result = y % 2 ** x
print(result)


n = int(input())
m = int(input())
if n > 100:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
if len(bin(m)[2:]) < n + 1:
	print(m)
else:
	s = bin(m)[2:]
	s = s[len(s) - n:len(s):1]
	print(int(s, 2))


def main():
	N = int(input())
	M = int(input())
	if N > 26:
		print(M)
	else:
		x = M % 2 ** N
		print(x)
main()


x = int(input())
y = int(input())
ans = y % 2 ** x
print(ans)


a = int(input())
b = int(input())
print(b % 2 ** a)


a = int(input())
b = int(input())
if a > 30:
	print(b)
else:
	print(b % 2 ** a)


n = int(input())
m = int(input())
if n > 1000:
	print(m)
	exit()
print(m % 2 ** n)


(n, m) = (int(input()), int(input()))
if n >= 31:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
num = 2
i = 1
while num < 100000000 and i < n:
	num *= 2
	i += 1
if num > 100000000:
	print(m)
else:
	print(m % num)


from math import *
n = int(input())
m = int(input())
x = 1
while n > 0 and m >= x:
	x *= 2
	n -= 1
print(int(m % x))


import math
n = int(input())
m = int(input())
x = m % (1 << n)
print(x)


(n, m) = (int(input()), int(input()))
if n > 26:
	print(m)
	exit()
print(m % 2 ** n)


n = int(input())
m = int(input())
print(m % pow(2, n))


import math

def f(y):
	if y == 0:
		return 1
	if y % 2 == 0:
		var = f(y // 2)
		return var * var
	else:
		var = f(y // 2)
		return var * var * 2
n = int(input())
m = int(input())
print(m % f(n))


n = int(input())
m = int(input())
if n <= 26:
	print(m % 2 ** n)
else:
	print(m)


n = int(input())
m = int(input())
print(m if n > 27 else m % 2 ** n)


from sys import stdin, stdout, setrecursionlimit
from gc import disable
gets = input
puts = print
input = stdin.readline
print = stdout.write

def main() -> int:
	disable()
	n = int(input())
	m = int(input())
	print('%i' % (m % (1 << n)))
	return 0
main()


n = int(input())
m = int(input())
print(m.__mod__(1 << n))


import math
n = int(input())
m = int(input())
if m > n:
	n = 2 ** n
	if m >= n:
		print(m % n)
	else:
		print(m)
else:
	print(m)


def solve(n, m):
	return m if n > 30 else m % 2 ** n

def main():
	n = int(input())
	m = int(input())
	print(solve(n, m))
main()


def calc(n, m):
	(a, b) = (2, 1)
	while b < n:
		if a > m:
			return m
		a *= 2
		b += 1
	if a == m:
		return 0
	else:
		return m % a
n = int(input())
m = int(input())
print(calc(n, m))


import math
(n, m) = (int(input()), int(input()))
l = math.log(m, 2)
l = math.ceil(l)
if n <= l:
	print(m % 2 ** n)
else:
	print(m)


n = int(input())
m = int(input())
if n > 64:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
tN = 1
for i in range(1, n + 1):
	tN = tN * 2
	if tN > m:
		print(m)
		exit()
print(m % tN)


f = lambda : map(int, input().split())
n = int(input())
m = int(input())
print(m % 2 ** n if n <= 26 else m)


x = input()
y = input()
if len(x) >= len(y) and len(x) >= 8 or len(x) >= 8:
	print(y)
else:
	t = pow(2, int(x))
	print(int(y) % t)


import math
n = int(input())
m = int(input())
l = int(math.log2(m))
if l < n:
	print(m)
else:
	print(m % pow(2, n))


import math
import sys
n = int(sys.stdin.readline())
m = int(sys.stdin.readline())
if math.log2(m) < n:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
k = 1
s = 2
while m >= s:
	k += 1
	s *= 2
s //= 2
k -= 1
if n == 1:
	print(m % 2)
elif k >= n:
	while k > n:
		k -= 1
		s //= 2
	print(m % s)
else:
	print(m)


(n, m) = (int(input()), int(input()))
print(pow(m, 1, pow(2, n)) if n <= 27 else m)


from math import *
n = int(input(''))
m = int(input(''))
if n > int(log2(m)):
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
n = 2 << n - 1
print(m % n)


n = int(input())
m = int(input())
if n > 10000:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
temp = m
power = 1
for i in range(n):
	temp //= 2
	power *= 2
	if temp == 0:
		break
print(m - temp * power)


n = int(input())
m = int(input())
if n > 50:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
q = 1 << n
p = m & q - 1
print(p)


def main():
	n = int(input())
	m = int(input())
	if n <= 30:
		print(m % (1 << n))
	else:
		print(m)
main()


n = input()
m = input()
answ = int(m) % 2 ** int(n)
print(answ)


import math

def main():
	n = int(input())
	m = int(input())
	if n <= 32:
		print(m % 2 ** n)
	else:
		print(m)
main()


from sys import stdin
[n] = list(map(int, stdin.readline().strip().split()))
[m] = list(map(int, stdin.readline().strip().split()))
sol = m % (1 << n)
print(sol)


n = int(input())
m = int(input())
if n > 31:
	n = 31
print(m % pow(2, n))


import sys

def main():
	input = sys.stdin.readline
	n = int(input())
	m = int(input())
	print(m % (1 << n))
main()


n = int(input())
m = int(input())
res = m % (1 << n)
print(res)


N = int(input())
M = int(input())
if N > 32:
	print(M)
else:
	print(M % (1 << N))


def Fast_power(x, y):
	res = 1
	while y > 0:
		if y % 2 != 0:
			res = res * x
		y = y // 2
		x = x * x
	return res
n = int(input())
m = int(input())
if n <= 40:
	print(m % Fast_power(2, n))
else:
	print(m)


i = lambda : int(input())
print((1 << min(64, i())) - 1 & i())


a = int(input())
b = int(input())
print(b if a >= 31 else b % (1 << a))


n = int(input())
m = int(input())
c = 0
p = 1
while True:
	if p < 10 ** 8:
		c += 1
		p *= 2
	else:
		break
if n > c:
	print(m)
else:
	print(m % 2 ** n)


import sys
input = sys.stdin.buffer.readline
n = int(input())
m = int(input())
s = 1
count = 0
while s <= m and count < n:
	count += 1
	s *= 2
if count == n:
	print(m % s)
else:
	print(m)


x = int(input())
y = int(input())
if x > 30:
	print(y)
else:
	s = 2 ** x
	print(y % s)


import sys
lines = sys.stdin.readlines()
n = int(lines[0].strip())
m = int(lines[1].strip())
if n > 1:
	n = 2 << n - 1
else:
	n = 2 ** n
m = m % n
print(m)


n = int(input())
m = int(input())
x = 1
if n < 30:
	for i in range(n):
		x = x * 2
	res = m - x * int(m / x)
else:
	res = m
print(res)


n = int(input())
m = int(input())
b = bin(m)
print(int(b[-min(n, len(b) - 2):], base=2))


def main():
	n = int(input())
	m = int(input())
	print(m % (1 << n) if m >> n else m)
try:
	while True:
		main()
except EOFError:
	pass


n = int(input())
m = int(input())
jmlh_pangkat = 0
nilai_m = m
if m % 2 == 0:
	while nilai_m >= 2:
		jmlh_pangkat += 1
		nilai_m = nilai_m / 2
else:
	nilai_m = nilai_m + 1
	while nilai_m >= 2:
		jmlh_pangkat += 1
		nilai_m = nilai_m / 2
if n > jmlh_pangkat:
	jawab = m
	print(jawab)
else:
	jawab = m % 2 ** n
	print(jawab)


from math import *
n = int(input())
m = int(input())
print(m % 2 ** n)


n = int(input())
m = int(input())
num = 1
for i in range(n):
	num *= 2
	if num > m:
		break
print(m % num)


from sys import stdin, stdout
n = int(stdin.readline())
m = int(stdin.readline())
mod = m % 2 ** n
stdout.write(str(mod))


n = int(input())
m = int(input())
if n < 27:
	result = m % (1 << n)
else:
	result = m
print(result)


k = 1
n = int(input())
m = int(input())
s = 0
while k <= m:
	k *= 2
	s += 1
if n > s:
	print(m)
else:
	print(m % min(k, 2 ** n))


n = int(input())
m = int(input())
r = 1
for power in range(n):
	r *= 2
	if r > m:
		print(m)
		break
else:
	if r == m:
		print(0)
	else:
		print(m % r)


def clacl(n, m):
	if n >= m:
		return m
	if m >= n and len(str(n)) >= 8 and (len(str(m)) >= 8):
		return m
	return m % 2 ** n
n = int(input())
m = int(input())
print(clacl(n, m))


import sys
import math
m = int(input())
n = int(input())
print(n % pow(2, m))


n = int(input())
m = int(input())
m = bin(m)[2:]
l = len(m)
m = m[max(l - n, 0):]
print(int(m, 2))


n = int(input())
m = int(input())

def solve():
	if n >= 30:
		print(m)
	else:
		print(m % 2 ** n)
solve()


factor = []
n = int(input())
m = int(input())
curr = 2
if n > 27:
	print(m)
else:
	print(m % 2 ** n)


n = input()
m = input()
t = bin(int(m))[2:][-int(n):]
print(int(t, 2))


n = int(input())
m = int(input())
ans = m % 2 ** n
print(ans)


n = int(input())
m = int(input())
x = 1
while n > 0:
	x *= 2
	if x > m:
		print(m)
		break
	n -= 1
if n == 0:
	print(m % x)


n = int(input())
m = int(input())
if n > 35:
	print(m)
else:
	print(m % 2 ** n)


a = min(int(input()), 60)
b = int(input())
print(b % 2 ** a)


from sys import stdin, stdout
n = int(stdin.readline())
m = int(stdin.readline())
if n >= 100:
	stdout.write(str(m))
else:
	stdout.write(str(m % 2 ** n))


x = int(input())
y = int(input())
print(y % (1 << x))


n = int(input())
m = int(input())
num = 2
s = 2
if n <= m // 2:
	while s * s <= n:
		if int(n) % s == 0:
			while int(n) % s == 0:
				num = num ** s
				n = int(n) // s
			s = 2
		if s == 2:
			s += 1
		else:
			s += 2
	print(int(m - m // num ** n * num ** n))
else:
	print(m)


import math
s1 = int(input())
s2 = int(input())
limit = math.log(100000000, 2)
if s1 > limit:
	print(s2)
else:
	print(s2 % 2 ** s1)


a = int(input())
b = int(input())
if a >= 32:
	print(b)
else:
	print(b % 2 ** a)


from math import ceil
n = int(input())
m = int(input())
if n <= 27:
	print(ceil(m % pow(2, n)))
else:
	print(m)


n = int(input())
m = int(input())
flag = 0
for i in range(n):
	if m <= 2 ** i:
		print(m)
		flag = 1
		break
if flag == 0:
	print(m % 2 ** n)


n = int(input())
m = int(input())
n = min(n, 32)
print(m % 2 ** n)


n = int(input())
m = int(input())
stepen = 2
k = 1
while stepen <= m and k < n:
	stepen *= 2
	k += 1
print(int(m % stepen))


n = int(input())
m = int(input())
if n > m or 2 ** n > m:
	print(m)
else:
	print(m % 2 ** n)


def rvc(n, m):
	return m % 2 ** n
n = int(input())
m = int(input())
print(rvc(n, m))


n = int(input())
m = int(input())
if n >= m:
	print(m)
elif n > 1000 or m > 1000:
	if abs(n - m) <= 1:
		print(m)
	else:
		a = 2 ** n
		print(m % a)
else:
	a = 2 ** n
	print(m % a)


a = int(input())
b = int(input())
deli = 1
res = 0
if a == 0:
	deli = 1
else:
	for i in range(a):
		deli *= 2
		if deli > b:
			res = b
			break
if res:
	print(res)
else:
	print(b % deli)


n = int(input())
m = int(input())
res = 1
while res < m and n > 0:
	res *= 2
	n -= 1
if n == 0:
	print(m % res)
else:
	print(m)


n = int(input())
m = int(input())
if n >= 37:
	print(m)
else:
	print(m % 2 ** n)


def main():
	n = int(input())
	m = int(input())
	if n >= 27:
		res = m
	else:
		res = m % 2 ** n
	print(res)
main()


n = int(input())
m = int(input())
z = 2
k = 0
while z <= m:
	z = z * 2
	k = k + 1
if k < n:
	print(m)
if n <= k:
	print(m % 2 ** n)


n = int(input())
m = int(input())
a = pow(2, n, 10000000000)
b = m % a
print(b)


def modulo(a, k):
	if a > 30:
		return k
	return k % 2 ** a
n = int(input())
m = int(input())
print(modulo(n, m))


(n, m) = (int(input()), int(input()))
bin_m = bin(m)[2:]
print(int(bin_m[-min(n, len(bin_m)):], 2))


n = int(input())
m = int(input())
count = 1
rem = 0
if n > 32:
	print(m)
else:
	while n > 0:
		rem += count * (m % 2)
		m = int(m / 2)
		count *= 2
		n -= 1
	print(int(rem))


import math
(n, m) = (int(input()), int(input()))
p = int(math.log(m, 2))
print(m if n > p else m % 2 ** n)


import math
n = int(input())
m = int(input())
if n >= m:
	print(m)
else:
	H = math.floor(math.log(m, 2))
	if n > H:
		print(m)
	else:
		print(m % 2 ** n)


while True:
	try:
		n = input()
		m = input()
		if int(n) > 27:
			print(m)
		else:
			print(int(m) % 2 ** int(n))
	except EOFError:
		break


n = int(input())
m = int(input())
t = m
log = 0
while t > 1:
	log += 1
	t //= 2
if n > log:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
print(int(input()) % (1 << n))


n = int(input())
m = int(input())
if len(bin(m)) - 2 < n:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
if n > 100:
	print(m)
	exit()
print(m % 2 ** n)


n = int(input())
m = int(input())
if n > 100:
	y = m
else:
	x = 2 ** n
	y = m % x
print(y)


from math import log2, ceil
n = int(input())
m = int(input())
mm = m
p = 0
while m % 2 == 0:
	p += 1
	m //= 2
if p >= n:
	print(0)
elif ceil(log2(mm)) < n:
	print(mm)
else:
	print(mm % 2 ** n)


from sys import stdin

def binpow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res
n = int(stdin.readline())
m = int(stdin.readline())
if n >= 27:
	print(m)
else:
	print(m % binpow(2, n))


a = int(input())
b = int(input())
k = 1
for i in range(a):
	k *= 2
	if b < k:
		break
if b < k:
	print(b)
else:
	print(b % k)


n = int(input())
m = int(input())
if n > 70:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
a = int(input())
b = 0
f = 1
while a > 0 and n > 0:
	b += a % 2 * f
	a = a // 2
	f *= 2
	n -= 1
print(b)


n = int(input())
m = int(input())
r = m % (1 << n)
print(r)


import math
n = int(input())
m = int(input())
if math.log(m, 2) < n:
	print(m)
else:
	e = 2 ** n
	print(m % e)


n = int(input())
m = int(input())
x = m % 2 ** n
print(int(x))


x = int(input())
y = int(input())

def modular():
	if x >= 27:
		return y
	else:
		return y % 2 ** x
print(modular())


n = int(input())
m = int(input())
k = 1
i = 0
while k <= m and i != n:
	i += 1
	k = k * 2
if k > m:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
if n > m or n >= 27:
	print(m)
else:
	rem = m % 2 ** n
	print(rem)


n = int(input())
m = int(input())
if n > 29:
	print(m)
else:
	print(m % 2 ** n)


n = list(map(int, input().strip().split()))[0]
m = list(map(int, input().strip().split()))[0]
for i in range(1, n + 1):
	if 2 ** i > m:
		print(m)
		break
	if i == n:
		print(m % 2 ** i)
		break


read = lambda : map(int, input().split())
(n, m) = (int(input()), int(input()))
if n < 100:
	print(m % 2 ** n)
else:
	print(m)


n = int(input())
m = int(input())
if n >= 27 and m <= 100000000:
	print(m)
else:
	print(m % 2 ** n)


import math
N = int(input())
M = int(input())
if N > int(math.log2(10 ** 8)):
	print(M)
else:
	print(M % 2 ** N)


R = lambda : list(map(int, input().split()))
(n, m) = (R()[0], R()[0])
print(m if n >= 30 else m % (1 << n))


n = int(input())
m = int(input())
if n >= 31:
	ans = m
else:
	ans = m % (1 << n)
print(ans)


n = int(input())
m = int(input())
mod = 0
for i in range(n):
	if m % 2 == 0:
		m //= 2
	else:
		mod += 2 ** i
		m //= 2
	if m == 0:
		break
print(mod)


n = int(input())
m = int(input())
if n >= 27:
	print(m)
else:
	a = 2 ** n
	c = m % a
	print(c)


import math
n = int(input())
m = int(input())
if n > 32:
	n = 32
print(m % 2 ** n)


n = int(input())
m = int(input())
print(m - (m >> n << n))


import math
n = int(input())
m = int(input())
if n >= m:
	print(m)
elif math.log2(m) < n:
	print(m)
else:
	print(m % 2 ** n)


m = int(input())
n = int(input())
if (1 <= m <= 10 ** 8, 1 <= n <= 10 ** 8):
	print(n % 2 ** m)


n = int(input())
m = int(input())
mod = 1
while n > 0:
	mod *= 2
	n -= 1
	if mod > m:
		break
print(m % mod)


n = int(input())
m = int(input())
if m <= n or (m - n == 1 and m != 2):
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
n_1 = 10
while 2 ** n_1 < 10 ** 8:
	n_1 += 1
count = 1
if n > n_1:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
y = int(pow(2, n))
z = int(m % y)
print(z)


b = int(input())
p = int(input())
print(p % (1 << b))


n = int(input())
m = int(input())
p = 1
while p <= m and n > 0:
	p *= 2
	n -= 1
print(m % p)


a = int(input())
b = int(input())
if a >= 30:
	print(b)
else:
	print(b % (1 << a))


import sys

def main():
	n = int(sys.stdin.readline())
	m = int(sys.stdin.readline())
	if n >= 31:
		print(m)
	else:
		print(m % 2 ** n)
main()


from math import pow
n = int(input())
m = int(input())
if n > 26:
	answer = m
else:
	answer = m % pow(2, n)
print(int(answer))


def main():
	expos = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864]
	n = int(input())
	m = int(input())
	print(m % expos[n] if n < len(expos) else m)
main()


n1 = int(input())
n2 = int(input())
m1 = pow(2, n1)
d = n2 % m1
print(d)


n = int(input())
m = int(input())
if n > 4 * 18:
	print(m)
else:
	print(m % pow(2, n))


n = int(input())
m = int(input())
q = 1
counter = 0
for i in range(0, n):
	q *= 2
	if q > m:
		print(m)
		counter = 1
		break
if counter == 0:
	p = m % q
	print(p)


n = int(input())
m = int(input())
now = 1
flag = False
for i in range(n):
	now *= 2
	if now > m:
		flag = True
		break
if flag:
	print(m)
else:
	print(m % now)


x = int(input())
y = int(input())
z = x // 10
if len(str(y)) < z:
	print(y)
else:
	print(y % 2 ** x)


n = eval(input())
m = eval(input())
if n >= 27:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
mod = m % 2 ** n
print(mod)


n = int(input())
m = int(input())
if n <= 60:
	print(m % 2 ** n)
else:
	print(m)


n = int(input())
m = int(input())
(i, j) = (2, 1)
while j < n:
	if i > m:
		results = m
		break
	else:
		i *= 2
		j += 1
if m % i == 0:
	results = 0
else:
	results = m % i
print(results)


a = int(input())
b = int(input())
print(b % (1 << a))


n = int(input())
m = int(input())
n = min(n, 30)
print(m % 2 ** n)


import math
n = int(input())
m = int(input())
if n <= 32:
	print(int(m % math.pow(2, n)))
else:
	print(m)


n = int(input())
m = int(input())
x = 1 << n
print(m % x)


def main():
	n = int(input())
	m = int(input())
	if n >= 100:
		print(m)
	else:
		print(m % 2 ** n)
main()


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
m = inp()
i = 1
ans = 1
while i <= n:
	ans *= 2
	if ans > m:
		print(m)
		exit(0)
	i += 1
print(m % ans)


import math
n = int(input())
m = int(input())
c = math.log(m, 2)
if c >= n:
	print(m % 2 ** n)
else:
	print(m)


n = int(input())
m = int(input())
if n > 1000:
	print(m)
else:
	print(m % 2 ** n)


def main():
	N = int(input())
	M = int(input())
	mod = M % 2 ** N
	print(mod)
main()


n = int(input())
m = int(input())
x = m ** (1 / n)
if x < 2:
	print(m)
else:
	print(m % 2 ** n)


R = lambda : map(int, input().split())
n = int(input())
m = int(input())
if n == 1:
	print(m % 2)
elif n == 0:
	print('0')
elif n + 1 > len(bin(m)) - 2:
	print(m)
else:
	l = n
	a = bin(m)[2:]
	a = bin(m)[-l:]
	print(int(a, 2))


n = int(input())
m = int(input())
b = str(bin(m))[2:]
print(int(b[-n:], 2))


def main():
	n = int(input())
	m = int(input())
	if n > 28:
		print(m)
	else:
		print(m % 2 ** n)
main()


import math
n = int(input())
m = int(input())
if n < 27:
	a = pow(2, n)
	print(int(m % a))
else:
	print(m)


import math
n = int(input())
m = int(input())
if math.log(m) + 1 < 2 * math.log(n):
	print(m)
else:
	print(m % 2 ** n)


s = int(input())
s1 = int(input())
if s > 27:
	print(s1)
else:
	print(s1 % 2 ** s)


n = int(input())
m = int(input())
if n > 28:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
ans = int('1' + n * '0', 2)
print(m % ans)


n = int(input())
m = int(input())
p = 1
if n >= 27:
	print(m)
else:
	for i in range(0, n):
		p = p * 2
	print(m % p)


n = int(input())
m = int(input())
c = 1
if n >= m:
	print(m)
else:
	c = 1
	j = 0
	for i in range(n):
		c = c * 2
		if c > m:
			break
		j = j + 1
	if j < n - 1:
		print(m)
	else:
		p = m % 10 ** n
		print(p % c)


a = int(input())
b = int(input())
print(b if a >= 32 else b % (1 << a))


def solve(n, m):
	if n > 64:
		return m
	x = pow(2, n)
	return m % x
a = int(input())
b = int(input())
print(solve(a, b))


import math

def hpt(n):
	p = int(math.log2(n))
	return p
n = int(input())
m = int(input())
z = hpt(m)
if n > z:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())

def f(n, m):
	return m % (1 << n) if m >= 1 << min(30, n) else m
print(f(n, m))


row = input().split(' ')
n = int(row[0])
x = input().split(' ')
m = int(x[0])
mod = pow(10, 9 + 7)

def powmod(base, b):
	if b == 1:
		return base
	elif b % 2 == 0:
		return pow(powmod(base, b / 2), 2) % mod
	else:
		return pow(powmod(base, (b - 1) / 2), 2) * base % mod
print(m % powmod(2, n))


import sys
import math
n = int(input())
m = int(input())
p = 1
k = int(math.log2(10 ** 18) + 1)
if n > k:
	print(m)
else:
	for i in range(0, n):
		p *= 2
	print(m % p)


n = int(input())
m = int(input())
if n >= m:
	print(m)
else:
	print(m % pow(2, n))


import math as math
n = int(input())
m = int(input())
if n >= 30:
	print(m)
	exit(0)
print(m % pow(2, n))


from sys import stdin, stdout
n = int(stdin.readline())
m = int(stdin.readline())
stdout.write('%d\n' % (m % (1 << n)))


def modulo(m, n):
	if n >= 27:
		return m
	if n < 27:
		return m % 2 ** n
import sys
n = int(sys.stdin.readline())
m = int(sys.stdin.readline())
print(modulo(m, n))


n = int(input())
m = int(input())
if n < 27:
	dividend = pow(2, n)
	r = m % dividend
	print(r)
else:
	print(m)


n = int(input())
m = int(input())
ost = m
st = [1, 0]
while st[1] < n:
	st[0] *= 2
	st[1] += 1
	if st[0] > m:
		ost = m
		break
	else:
		ost = m % st[0]
print(ost)


n = int(input())
m = int(input())
pw = 1
fl = 0
for i in range(n):
	pw = pw * 2
	if pw > m:
		fl = 1
		break
if fl == 1:
	print(m)
else:
	print(m % pw)


n = int(input())
m = int(input())
mx = 0
for i in range(30):
	if 2 ** i == m and i == n:
		print(0)
		exit(0)
	elif 2 ** i > m:
		mx = i
		break
if n > mx:
	print(m)
else:
	print(m % 2 ** n)


from math import log
n = int(input())
m = int(input())
lm = log(m, 2)
if n > lm:
	print(m)
elif n == lm:
	print(0)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
if n >= 30:
	print(m)
else:
	print(pow(m, 1, 2 ** n))


def binpow(a, n):
	if n == 1:
		return a
	if n % 2 == 0:
		d = int(binpow(a, n / 2))
		return d * d
	else:
		return binpow(a, n - 1) * a
n = int(input())
m = int(input())
if n >= 27:
	print(m)
else:
	print(m % binpow(2, n))


n = int(input())
m = int(input())
mod = 1
if n < 50:
	for i in range(n):
		mod *= 2
	print(m % mod)
else:
	print(m)


n = int(input())
m = int(input())
a = 2 ** n
print(m % a)


n = int(input())
m = bin(int(input()))[2:]
print(int(m[-1 * min(n, len(m)):], 2))


n = int(input(''))
m = int(input(''))
ch = bin(m)[2:]
if len(ch) < n + 1:
	print(m)
else:
	ch = ch[len(ch) - n:]
	x = int(ch, 2)
	print(x)


def modExp(n, p, k):
	if p == 0:
		return 1
	r = modExp(n, p // 2, k)
	if r and r < k:
		if p % 2:
			return r * r * n
		return r * r
n = int(input())
m = int(input())
k = modExp(2, n, m)
if k:
	print(m % k)
else:
	print(m)


n = int(input())
m = int(input())
s = m % 2 ** n
print(s)


n = int(input())
m = int(input())
val = bin(m)[2:]
print(int(val[-n:], 2))


from math import *

def main():
	n = int(input())
	m = int(input())
	t = 1
	check = True
	for i in range(n):
		t = t * 2
		if t > m:
			print(m)
			check = False
			break
	if check == True:
		print(m % t)
main()


n = int(input())
m = int(input())
x = bin(m)
x = x[max(len(x) - n - 2, 0) + 2:]
s = 1
ans = 0
for i in range(len(x) - 1, -1, -1):
	ans += int(x[i]) * s
	s = s << 1
print(ans)


n = int(input())
m = int(input())
pr = 2
k = 1
if n > 30:
	n = 30
while k < n:
	pr = pr * 2
	k = k + 1
print(m % pr)


def revpowmod(n, m):
	if n > 30:
		return m
	return m % 2 ** n

def main():
	n = int(input())
	m = int(input())
	print(revpowmod(n, m))
main()


y = int(input())
x = int(input())
if y > 30:
	print(x)
else:
	z = 1
	for i in range(y):
		z *= 2
	print(x % z)


n = int(input())
b = int(input())
print(b % (1 << n))


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	m = int(sys.stdin.readline().strip())
	print(m if n > 28 else m % pow(2, n))
main()


a = int(input())
b = int(input())
c = a - 1
print(b % (2 << c))


n = int(input())
m = int(input())
mody = 1 << n
print(m % mody)


n = int(input())
if n > 30:
	n = 30
m = int(input())
ans = 2 ** n
ans = m % ans
print(ans)


n = int(input())
m = int(input())
n = min(n, 64)
print(m % 2 ** n)


import math
n = int(input())
m = int(input())
x = int(math.floor(math.log(m + 1) / math.log(2) - 1))
rem = m + 1 - (1 << x + 1)
if x < n:
	print(m % (1 << n))
else:
	print(((1 << n) - 1 + rem) % (1 << n))


n = int(input())
m = int(input())
d = 2
c = 1
while c < n and d < m:
	d *= 2
	c += 1
if c < n:
	print(m)
else:
	print(m % d)


a = int(input())
b = int(input())
from math import *
if a > ceil(log(b, 2)):
	print(b)
else:
	print(b % 2 ** a)


n = int(input())
m = int(input())
k1 = bin(m)
k = k1.replace('0b', '')
lenth = len(k)
if lenth < n + 1:
	print(m)
else:
	print(int(k[-n:], 2))


def main():
	b = 1
	step = int(input())
	a = int(input())
	if step < 100:
		for i in range(step):
			b = b << 1
		print(a % b)
	else:
		print(a)
main()


n = int(input())
print(int(input()) % 2 ** min(n, 40))


(N, M) = (int(input()), int(input()))
if N <= 31:
	print(M % 2 ** N)
else:
	print(M)


n = int(input())
m = int(input())
print(pow(m, 1, 1 << n))


n = int(input())
m = int(input())
b = 2
i = 0
while m >= b:
	b *= 2
	i += 1
if n > i:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
t = len(bin(m)) - 2
if n >= t:
	print(m)
else:
	print(m % (1 << n))


MOD = 100000000000000000000000000000000000000000007

def fast_power(base, power):
	result = 1
	while power > 0:
		if power % 2 == 1:
			result = result * base % MOD
		power = power // 2
		base = base * base % MOD
	return result
n = int(input())
m = int(input())
a = fast_power(2, n)
print(m % a)


n = int(input())
l = int(input())
if n > l / 2:
	print(l)
else:
	r = 2 ** n
	s = l % r
	print(s)


n = int(input())
print(int(input()) % 2 ** n)


def B(n, m):
	return m % n

def A():
	n = 2 ** int(input())
	m = int(input())
	print(B(n, m))
A()


n = int(input())
m = int(input())
if n > 40:
	print(m)
else:
	print(m % 2 ** n)


N = int(input())
M = int(input())
pw = 1
tw = 2
while tw < M and pw < N:
	tw = tw * 2
	pw += 1
if pw < N:
	print(M)
else:
	tn = int(pow(2, N))
	print(M % tn)


def ModularExponentiation():
	n = int(input())
	m = int(input())
	if m <= n or n > 27:
		print(m)
	else:
		print(m % 2 ** n)
ModularExponentiation()


n = int(input())
m = int(input())
if n > 300:
	print(m)
else:
	x = m % 2 ** n
	print(x)


import math

def main():
	n = int(input())
	m = int(input())
	print(m % 2 ** n)
main()


def ex(base, exp):
	ans = 1
	for i in range(exp):
		ans = ans * base
	return ans
n = int(input())
m = int(input())
if n >= 30:
	print(m)
else:
	print(m % ex(2, n))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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 LF():
	return [float(x) for x in sys.stdin.readline().split()]

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

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	m = I()
	t = 1
	for _ in range(n):
		t *= 2
		if t > m:
			return m
	return m % t
print(main())


n = int(input())
m = int(input())
x = 2
flag = True
for i in range(1, n):
	x = x << 1
	if x > m:
		flag = False
		print(m)
		break
if flag:
	print(m % x)


n = int(input())
m = int(input())
tmp = m
count = 0
while tmp > 0:
	tmp //= 2
	count += 1
if count < n:
	print(m)
else:
	print(m % pow(2, n))


n = int(input())
m = int(input())
se = 0
if n >= m:
	print(m)
else:
	ans = 1
	for i in range(1, n + 1):
		if ans * 2 > m:
			se = 1
			print(m)
			break
		else:
			ans *= 2
	if se == 0:
		print(m % ans)


(b, a) = (int(input()), int(input()))
print(a & (1 << min(b, 32)) - 1)


import sys

def main():
	n = int(input())
	m = int(input())
	if n < 50:
		m = m % pow(2, n)
	print(m)

def __starting_point():
	main()
__starting_point()


n = int(input())
if n >= 100:
	n = 100
m = int(input())
print(m % pow(2, n))


import math
import sys
from collections import deque

def scan():
	return list(map(int, sys.stdin.readline().strip().split()))

def solution():
	n = int(input())
	m = int(input())
	if n < 27:
		print(m % 2 ** n)
	else:
		print(m)
solution()


import math
n = int(input())
m = int(input())
upper_n = 1
for i in range(30):
	tmp = pow(2, i)
	if tmp > 10 ** 8:
		upper_n = i
		break
if n > upper_n:
	print(m)
else:
	print(m % pow(2, n))


n = int(input())
m = int(input())
if n >= 27:
	print(m)
elif n < 27:
	print(m % 2 ** n)


N = int(input())
M = int(input())
if N > 50:
	print(M)
else:
	print(M % 2 ** N)


n = int(input())
m = int(input())
d = 1
deg = 0
while deg < n:
	if d > m:
		print(m)
		exit()
	d *= 2
	deg += 1
print(m % d)


def translation():
	word_1 = input()
	word_2 = input()[::-1]
	print(['NO', 'YES'][word_1 == word_2])
	return

def anton_and_danik():
	games = int(input())
	wins = input()
	anton_wins = sum((i == 'A' for i in wins))
	if anton_wins * 2 > len(wins):
		print('Anton')
	elif anton_wins * 2 == len(wins):
		print('Friendship')
	else:
		print('Danik')
	return

def acoomodation():
	cnt = 0
	for _ in range(int(input())):
		(p, q) = map(int, input().split())
		if q - p >= 2:
			cnt += 1
	print(cnt)
	return

def juicer():
	(n, b, d) = map(int, input().split())
	sum_orange = 0
	cnt_empty = 0
	for orange in list(map(int, input().split())):
		if orange <= b:
			sum_orange += orange
			if sum_orange > d:
				cnt_empty += 1
				sum_orange = 0
	print(cnt_empty)
	return

def digit_game():
	for game in range(int(input())):
		breach_odd_cnt = 0
		breach_even_cnt = 0
		raze_odd_cnt = 0
		raze_even_cnt = 0
		n = int(input())
		number = input()
		breach_numbers = ''
		raze_numbers = ''
		len_number = len(number)
		idx = 1
		for digit in number:
			if idx % 2 == 0:
				breach_numbers += digit
				if digit in '13579':
					breach_odd_cnt += 1
				else:
					breach_even_cnt += 1
			else:
				raze_numbers += digit
				if digit in '13579':
					raze_odd_cnt += 1
				else:
					raze_even_cnt += 1
			idx += 1
		if len_number == 1:
			if int(number) % 2 == 0:
				print(2)
			else:
				print(1)
		elif len_number % 2 == 0:
			if breach_even_cnt >= 1:
				print(2)
			else:
				print(1)
		elif raze_odd_cnt >= 1:
			print(1)
		else:
			print(2)
	return

def modular_exponentiation():
	n = int(input())
	m = int(input())
	calc = m % int(1 << n)
	print(int(calc))
	return
modular_exponentiation()


import sys
from itertools import *
from cmath import *
input = sys.stdin.readline
from math import *

def inp():
	return int(input().strip())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
m = inp()
print(m if n >= 31 else m % (1 << n))


import math
n = int(input())
m = int(input())
if math.ceil(pow(m, 0.5)) < n:
	print(m)
else:
	print(m % pow(2, n))


import sys
import math
import collections
from pprint import pprint as pp
mod = 1000000007
MAX = 10 ** 10

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat
(n, m) = (int(input()), int(input()))
ans = 1
while n > 0 and ans <= m:
	ans *= 2
	n -= 1
print(m % ans)


n = input()
m = input()
n = int(n)
m = int(m)
ar = []
arr = []
temp = m
cnt = 0
scnt = 0
while temp > 0:
	ar.append(temp % 2)
	temp = temp // 2
	scnt += 1
cnt = 0
while cnt < n and cnt < scnt:
	arr.append(0)
	cnt += 1
arr.append(1)
cnt = 0
newno = 0
while arr[cnt] != 1:
	newno += ar[cnt] * pow(2, cnt)
	cnt += 1
print(newno)


from math import *

def check_(m, n):
	cnt = 0
	m1 = m
	if m / 2 != 0:
		while m / 2 != 0:
			m /= 2
			cnt += 1
		if n <= cnt:
			return m1 % pow(2, n)
		else:
			return m1
n = int(input())
m = int(input())
if n >= m:
	print(m)
else:
	print(int(check_(m, n)))


z = lambda : int(input())
a = z()
b = z()
print(b if a > 27 or a > b else b % 2 ** a)


n = int(input())
m = int(input())
power = 1
while n > 0:
	if power > m:
		break
	power = power * 2
	n = n - 1
m = m % power
print(m)


import sys

def _readmethod():
	fin = sys.stdin
	for line in fin:
		for readstring in line.split():
			yield readstring
_read = _readmethod()
read = lambda : next(_read)
readInt = lambda : int(next(_read))
(n, m) = (readInt(), readInt())
if n <= 30:
	print(m % pow(2, n))
else:
	print(m)


n = int(input())
m = int(input())
string = str(bin(m))[2:]
if len(string) <= n:
	print(m)
else:
	print(int(string[len(string) - n:], 2))


n = int(input())
m = int(input())
t = 1 << n
print(m % t)


n = int(input())
m = int(input())
base = 1
for i in range(n):
	if base * 2 <= m:
		base = base * 2
	else:
		base = base * 2
		break
print(str(m % base))


n = int(input())
m = int(input())
if m > n and n < 80:
	print(m % 2 ** n)
else:
	print(m)


def main():
	n = int(input())
	m = int(input())
	print(m if n > 26 else m % (1 << n))
main()


a = [2 ** i for i in range(31)]
n = int(input())
m = int(input())
if n < 31:
	print(m % a[n])
else:
	print(m)


n = int(input())
b = int(input())
print(b % 2 ** n)


import sys
inf = float('inf')

def powerMod(x, y):
	res = 1
	while y > 0:
		if y & 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
m = int(input())
if n > 27:
	print(m)
else:
	print(m % powerMod(2, n))


n = int(input())
m = int(input())

def binaryExponentiation(x, n):
	if n == 0:
		return 1
	elif n % 2 == 0:
		return binaryExponentiation(x * x, n / 2)
	else:
		return x * binaryExponentiation(x * x, (n - 1) / 2)
if n >= 27:
	print(m)
else:
	y = binaryExponentiation(2, n)
	print(m % y)


n = int(input())
m = int(input())
(x, y) = (m, 1)
for i in range(n):
	y *= 2
	if y > x:
		break
print(x % y)


R = lambda : map(int, input().split())
n = int(input())
m = int(input())
m2 = '{0:b}'.format(m)
if len(m2) > n:
	k = n
else:
	k = len(m2)
print(int(m2[-k:], 2))


n = int(input())
m = int(input())
goon = True
import math
for i in range(0, n + 1):
	if math.pow(2, i) > m:
		c = m
		goon = False
		break
if goon:
	c = m % math.pow(2, n)
print(int(c))


asdfadsgsagf = int(input())
if asdfadsgsagf >= 101:
	asdfadsgsagf = 101
mfgdjfgjfg = int(input())
print(mfgdjfgjfg % pow(2, asdfadsgsagf))


import math

def bpow(n, k):
	ans = 1
	while k:
		if k % 2:
			ans *= n
		n *= n
		k //= 2
	return ans
k = int(input())
n = int(input())
print(n if k >= 30 else n % bpow(2, k))


N = int(input())
M = int(input())
if N >= 128:
	print(M)
else:
	print((1 << N) - 1 & M)


import math
n = int(input())
m = int(input())
if math.log2(m) < n:
	result = m
else:
	result = m % 2 ** n
print(result)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
m = ii()
n = min(n, 32)
print(m % 2 ** n)


n = int(input())
m = int(input())
aux = 2 ** n
print(m % aux)


n = int(input())
m = int(input())
tmp = m
d = 1
while m > 0:
	m //= 2
	d += 1
n = min(d, n)
print(tmp % 2 ** n)


n = int(input())
m = int(input())
if n >= m:
	m = m
elif (n + 1 == m) & (n >= 999):
	m = m
else:
	n = 2 ** n
	m = m % n
print(m)


import math
y = int(input())
x = int(input())
try:
	print(int(math.fmod(x, math.pow(2, y))))
except:
	print(x)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	m = inp()
	ans = 0
	c = 1
	while c < m:
		ans += 1
		c = c << 1
	if ans < n:
		print(m)
	else:
		print(m % power(2, n))
for _ in range(1):
	solve()


def list_output(s):
	print(' '.join(map(str, s)))

def list_input(s='int'):
	if s == 'int':
		return list(map(int, input().split()))
	elif s == 'float':
		return list(map(float, input().split()))
	return list(map(str, input().split()))
n = int(input())
m = int(input())
if n >= 32:
	print(m)
else:
	r = 2 ** n
	print(m % r)


(y, m) = (int(input()), int(input()))
print(m if y > m // 2 else m % pow(2, y))


n = int(input())
m = int(input())
curr = 1
while n > 0 and curr <= m:
	n -= 1
	curr *= 2
print(m % curr)


n = int(input())
m = int(input())
if n < 27:
	r = 2 ** n
	d = m % r
	print(d)
else:
	print(m)


import sys
n = int(sys.stdin.readline())
m = int(sys.stdin.readline())
if n < 33:
	print(m % 2 ** n)
else:
	print(m)


from math import log
n = int(input())
m = int(input())
if log(m, 2) < n:
	print(m)
	exit()
print(m % 2 ** n)


n = int(input())
m = int(input())
c = 0
d = 0
while c <= m:
	d += 1
	c = 2 ** d
	if d == n:
		print(m % c)
		break
else:
	print(m)


n = int(input())
m = int(input())
if n > m // 2:
	print(m)
else:
	r = 1
	a = 2
	while n > 0:
		if n % 2:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n // 2
	print(m % r)


def list_input():
	return input().split()

def int_list_input():
	return list(map(int, input().split()))

def find_max(list):
	for i in list:
		if i > 0:
			print(i)
n = int(input())
m = int(input())
if n > 30:
	print(m)
else:
	print(m % 2 ** n)


from sys import stdin
n = int(stdin.readline().strip())
m = int(stdin.readline().strip())
print(m if n > 30 else m % (1 << n))


n = int(input())
m = int(input())
if n >= 27:
	print(m)
	exit()
print(m % 2 ** n)


n = int(input())
m = int(input())
k = 2 ** n
print(m % k)


(n, m) = (int(input()), int(input()))
n = min(n, 31)
print(m % 2 ** n)


n = int(input())
m = int(input())
if n >= 27:
	print(m)
else:
	k = m % (1 << n)
	print(k)


def modi(n, m):
	if n >= 27:
		return m
	val = 2 ** n
	return m % val
n = int(input())
m = int(input())
print(modi(n, m))


def main():
	(n, m) = (int(input()), int(input()))
	if m.bit_length() >= n:
		m %= 1 << n
	print(m)
main()


from math import pow
n = int(input())
m = int(input())
if n >= 27:
	print(m)
	exit(0)
if n == 1:
	print(int(m % 2))
	exit(0)
print(int(m % pow(2, n)))


n = int(input())
m = int(input())
target = 1
while n > 0:
	target <<= 1
	n -= 1
	if target > m:
		print(m)
		exit()
print(m & target - 1)


n = int(input())
m = int(input())
y = 1 << n
print(m % y)


def main():
	n = int(input())
	m = int(input())
	if n <= 27:
		print(m % (1 << n))
	else:
		print(m)
main()


n = int(input())
m = int(input())
x = 2 ** min(n, 40)
print(m % x)


a1 = int(input())
a2 = input()
k = a1 // 10
k = 3 * k
if k > len(a2):
	print(a2)
else:
	print(int(a2) % 2 ** a1)


n = int(input())
m = int(input())
if n > m:
	print(m)
elif n == m:
	print(m)
else:
	pov = 1
	cpov = 0
	while pov < m:
		pov *= 2
		cpov += 1
	if cpov == n and m == pov:
		print(0)
	elif n >= cpov:
		print(m)
	else:
		print(m % 2 ** n)


def compute(m, n):
	if n > 30:
		return m
	return m % exp2[n]
exp2 = []
for i in range(31):
	exp2.append(2 ** i)
n = int(input())
m = int(input())
print(compute(m, n))


from random import randint
n = int(input())
m = int(input())
if n > 35 or 2 ** n > m:
	print(m)
else:
	print(m % 2 ** n)


n = int(input())
m = int(input())
if n < 500:
	print(m % 2 ** n)
else:
	print(m)


a = int(input())
b = int(input())
if a < b and a <= 27:
	print(b % 2 ** a)
else:
	print(b)


n = int(input())
m = int(input())
x = []
while m > 1:
	xi = len(list(bin(m).replace('0b', ''))) - 1
	x.append(xi)
	m = m - 2 ** xi
x.reverse()
y = m
if len(x) > 0:
	i = 0
	while i < len(x) and x[i] < n:
		y = y + 2 ** x[i]
		i = i + 1
	print(y)
elif len(x) == 0:
	print(y)


import math
n = int(input())
m = int(input())
a = pow(2, n)
print(m % a)


(n, m) = (int(input()), int(input()))
print(m if n > 32 else m & 2 ** n - 1)


n = int(input())
m = int(input())
m = bin(m)[2:]
j = min(len(m), n)
k = m[len(m) - j:]
ans = 0
for i in range(j):
	if k[i] == '1':
		ans += 2 ** (j - 1 - i)
print(ans)


n = int(input().strip())
m = int(input().strip())
b = bin(m)[2:]
if n > len(b):
	print(m)
else:
	print(int(b[len(b) - n:], 2))


import math
n = int(input())
m = int(input())
d = math.log(m) / math.log(2)
if d < n:
	print(m)
else:
	d = pow(2, n, 10000000001)
	print(m % d)


import sys
import math
m = int(input())
n = int(input())
print(n % min(n + 1, pow(2, m)))


n = int(input())
m = int(input())
if n > 10 ** 6:
	print(m)
else:
	d = m % 2 ** n
	print(d)


import math

def fast_exp(x, y):

	def even(y):
		if y % 2 == 0:
			return 1
		return 0
	if y == 0:
		return 1
	if even(y):
		return fast_exp(x, y / 2) ** 2
	return x * fast_exp(x, y - 1)
n = int(input())
m = int(input())
if math.log(m, 2) < n:
	print(m)
	exit(0)
else:
	print(m % fast_exp(2, n))


n = int(input())
m = int(input())
FLAG = 0
for i in range(n):
	if m <= pow(2, i):
		print(m)
		FLAG = 1
		break
if FLAG == 0:
	print(m % pow(2, n))


import math
n = int(input())
m = int(input())
for k in range(n + 1):
	r = 2 ** k
	if r > m:
		break
print(m % r)


n = int(input())
m = int(input())
big = 1000000000000000013287555072
ans = m % big % pow(2, n, big) % big
print(ans)


n = int(input())
m = int(input())
if n > 26:
	print(m)
	exit()
dereje = int(2 ** n)
if m > dereje:
	print(m % dereje)
	exit()
if m == dereje:
	print('0')
	exit()
print(m)


n = int(input())
m = int(input())
z = m % (1 << n)
print(z)


from itertools import permutations
MOD = 10 ** 9 + 7

def main():
	n = int(input())
	m = int(input())
	if n > 26:
		print(m)
	else:
		print(m % 2 ** n)
while 1:
	main()
	break


n = int(input())
print(int(input()).__mod__(pow(2, n)))


import math
n = int(input())
m = int(input())
z = math.log(m, 2)
if z < n:
	print(m)
else:
	t = math.pow(2, n)
	h = m % t
	print(int(h))


n = int(input())

def mexp(x, n, m):
	if n == 0:
		return 1
	elif n % 2 == 0:
		return mexp(x * x, n // 2, m)
	else:
		return x * mexp(x * x % m, (n - 1) // 2, m) % m
m = int(input())
print(mexp(m, 1, 2 ** n))


a = int(input())
b = int(input())
c = 1
n = 0
while c <= b:
	c *= 2
	n += 1
n -= 1
c = c // 2
if a == 1:
	print(b % 2)
elif n < a:
	print(b)
else:
	k = 1
	for i in range(a):
		k *= 2
	while True:
		if c + k > b:
			print(b - c)
			break
		else:
			c += k


n = int(input())
m = int(input())
cur = 2 ** n
print(m % cur)


n = int(input())
m = int(input())
ans = 0
i = 0
while n != 0 and m != 0:
	if m % 2 != 0:
		ans += pow(2, i)
	i += 1
	n -= 1
	m = m // 2
print(ans)


a = int(input())
b = int(input())
if a > b or a == b or (len(str(b)) > 7 and len(str(a)) > 7):
	print(b)
else:
	print(int(b % 2 ** a))