program ionah;
var
n,m,i,j,ans:longint;
c:array[0..1000] of longint;
begin
assign(input,'ionah.in');
assign(output,'ionah.out');
reset(input);
rewrite(output);
readln(n,m);
if n=3 then
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]);
close(input);
close(output);
end.