var
a,b,c,d,e,n,k:longint;
dp:array[0..20,0..20] of qword;
function min(xx,yy:qword):qword;
begin
if xx>yy then exit(yy)
else exit(xx);
end;
begin
assign(input,'k.in');
reset(input);
assign(output,'k.out');
rewrite(output);
readln(n,k);
for a:=1 to n do
dp[a,1]:=1;
for a:=1 to n do
for b:=2 to min(a,k) do
dp[a,b]:=dp[a-1,b-1]*(a-b+1)+dp[a-1,b]*b;
writeln(dp[n,k]);
close(input);
close(output);
end.