program ex;
type
ss=array[-10..1000]of longint;
var
a,b:ss;
f1,f2:text;
s,p:longint;
procedure init;
begin
assign(f1,'goat.in');
assign(f2,'goat.out');
reset(f1);
rewrite(f2);
readln(f1,s,p);
close(f1);
end;
procedure main;
var
i,j:longint;
flag:boolean;
begin
flag:=false;
i:=0;
repeat
inc(i);
if b[0]+1>a[0] then a[0]:=b[0]+1;
if (a[0]>=s) then
begin
writeln(f2,i);
close(f2);
halt;
end;
for j:=0 to p do
begin
a[j]:=b[j+1]+1;
if (b[j-2]+5>a[j])and(j>2) then a[j]:=b[j-2]+5;
if (b[j-5]+10>a[j])and(j>5) then a[j]:=b[j-5]+10;
if b[0]+1>a[j] then a[j]:=b[0]+1;
if (a[j]>=s) then
begin
writeln(f2,i);
close(f2);
halt;
end;
end;
b:=a;
until flag=true;
end;
begin
init;
main;
end.