program monoton;
var fin,fout:text;
    x,y:array[0..300005] of real;
    ax,bx,c,c1:real;
    a1,a2,min,i,ans,n,d:longint;
begin
assign(fin,'monoton.in'); reset(fin);
assign(fout,'monoton.out'); rewrite(fout);
readln(fin,n,d);
min:=n;
ans:=0;
c1:=0;
for i:=n+1 to 2*n do
  begin
   readln(fin,x[i],y[i]);
   x[i-n]:=x[i];
   x[i+n]:=x[i];
   y[i-n]:=y[i];
   y[i+n]:=y[i];
   if x[min]>x[i] then min:=i;
  end;
a1:=min-1;
a2:=min+1;
while ((a2-a1) mod n)<>0 do
begin
  if x[a1]=x[a2] then
   begin
    c:=y[a2]-y[a1];
    if c<0 then c:=-c;
    if c>=d then
     if c1<d then ans:=ans+1;
    if c<=d then
     if c1>d then ans:=ans+1;
    a1:=a1-1;
    a2:=a2+1;
    c1:=c;
   end
  else
   begin
    if x[a1]>x[a2] then
     begin
      ax:=(y[a1]-y[a1+1])/(x[a1]-x[a1+1]);
      bx:=y[a1]-ax*x[a1];
      c:=x[a2]*ax+bx-y[a2];
      if c<0 then c:=-c;
      if c>=d then
       if c1<d then ans:=ans+1;
      if c<=d then
       if c1>d then ans:=ans+1;
      a2:=a2+1;
      c1:=c;
     end else
     begin
      ax:=(y[a2]-y[a2+1])/(x[a2]-x[a2+1]);
      bx:=y[a2]-ax*x[a2];
      c:=x[a1]*ax+bx-y[a1];
      if c<0 then c:=-c;
      if c>=d then
       if c1<d then ans:=ans+1;
      if c<=d then
       if c1>d then ans:=ans+1;
      a1:=a1+1;
      c1:=c;
     end;
   end;
end;
if c1>d then ans:=ans+1;
writeln(fout,ans);
close(fout);
end.