program EmberAsh;
var
f:array[0..1000]of longint;
i,j,k,s,p,t1,t2,t3,t,s1,ss:longint;
fin,fout:text;
BEGIN
assign(fin,'goat.in');reset(fin);
assign(fout,'goat.out');rewrite(fout);
readln(fin,s,p);
f[0]:=0;
ss:=s;
for i:=1 to trunc(ss/3) do
begin
t1:=0;t2:=0;t3:=0;
if f[i-1]-1>=0 then
t1:=f[i-1]-1;
if f[i-1]+2<=p then
t2:=f[i-1]+2;
if f[i-1]+5<=p then
t3:=f[i-1]+5;
if t1>t2 then
begin
t:=t1;
s1:=1;
end
else
begin
t:=t2;
s1:=5;
end;
if t<t3 then
begin
t:=t3;
s1:=10;
end;
f[i]:=t;
s:=s-s1;
if s<=0 then
begin
writeln(fout,i);
halt;
close(fin);close(fout);
end;
end;
close(fin);close(fout);
END.