program ionah1;
var
n,m,i,j,k,ans:longint;
f:array[1..30,1..200] of longint;
c:array[1..10000] of longint;
begin
assign(input,'ionah.in');
assign(output,'ionah.out');
reset(input);
rewrite(output);
readln(n,m);
if n=3 then
begin
begin
c[1]:=1;
for i:=1 to m do
for j:=1 to 1000 do
begin
c[j]:=c[j]*2+c[j-1] div 10;
c[j-1]:=c[j-1] mod 10;
end;
end;
if c[1]<>0
then c[1]:=c[1]-1
else
begin
for i:=2 to 1000 do
if c[i]<>0 then
begin
c[i]:=c[i]-1;
break;
end;
for j:=1 to i-1 do c[j]:=9;
end;
for i:=1000 downto 1 do
if c[i]<>0 then break;
for j:=i downto 1 do
write(c[j]);
halt;
end;
for i:=1 to n do f[i][1]:=1;
for i:=2 to m do f[2][i]:=100000000;
for i:=3 to n do
for j:=2 to m do
begin
f[i,j]:=100000000;
for k:=1 to j-1 do
if f[i,j]>f[i,k]*2+f[i-1,j-k]
then f[i,j]:=f[i,k]*2+f[i-1,j-k];
end;
writeln(f[n,m]);
close(input);
close(output);
end.