program goat1;
type
t1=array[-5..105] of longint;
var
f1,f2:t1;
s,p:longint;
procedure init;
var
i:longint;
begin
assign(input,'goat.in');
reset(input);
assign(output,'goat.out');
rewrite(output);
readln(s,p);
close(input);
fillchar(f1,sizeof(f1),0);
fillchar(f2,sizeof(f2),0);
end;
procedure print(t1:longint);
begin
writeln(t1);
close(output);
halt;
end;
procedure main;
var
t,i:longint;
f:boolean;
begin
f:=true;
t:=0;
while f do
begin
inc(t);
for i:=0 to p do
begin
if (i+1<p) then f2[i]:=f1[i+1]+1;
if (f2[i]<(f1[i]+1))and(i=0) then f2[i]:=f1[i]+1;
if (i>2) then if (f2[i]<=(f1[i-2]+5)) then f2[i]:=f1[i-2]+5;
if (i>5) then if (f2[i]<=(f1[i-5]+10)) then f2[i]:=f1[i-5]+10;
if f2[i]>=s then print(t);
end;
for i:=0 to p do f1[i]:=f2[i];
end;
end;
begin
init;
main;
end.