n, x = gets.split.map &:to_i

mod = []

def x(p)
	2 * p + 3
end

seed = 1

n.times{
	seed = x(seed)
	mod << seed
}

mod.reverse!

count = 0

if x == mod[0] then
	puts mod[0] / 2 + 1
	exit
end

mod[1..-1].each{ |m|
	if x >= 2 * m + 2 then
		count += 2 * (m / 2 + 1)
		x = 0
		break
	elsif x >= m + 1 then
		if x >= m + 2 then
			x -= 1
			count += 1
		end

		count += (m / 2 + 1)
		x -= m
	end
	
	x -= 1
}

if x >= 3 then
	count += 1
end

puts count
