n=io.read("n")
x=io.read("n")
f={0}
for i=1,n do
	w={}
	table.insert(w,1)
	for i=1,#f do
		table.insert(w,f[i])
	end
	table.insert(w,0)
	for i=1,#f do
		table.insert(w,f[i])
	end
	table.insert(w,1)
	f=w
end
s=0
for i=1,x do
	if w[i]==0 then
		s=s+1
	end
end
print(s)
