1 #include<iostream>
2 #include<cstdio>
3 #include<algorithm>
4 #include<cmath>
5 using namespace std;
6
7 const int N = 100010 ;
8
9 struct node
10 {
11 double begin,end;
12 }lei[N];
13
14 double now= -20000000.0;
15 int n,m,ans;
16 bool flag=true;
17
18 bool cmp(node a,node b)
19 {
20 return a.end<b.end;
21 }
22 int main()
23 {
24 scanf("%d%d",&n,&m);
25 for(int i=1;i<=n;++i)
26 {
27 double a,b;
28 scanf("%lf%lf",&a,&b);
29 if(b>m)flag=false ;
30 double c=sqrt(m*m-b*b);
31 lei[i].begin=a-c;
32 lei[i].end=a+c;
33 }
34 if(flag==false)
35 {
36 printf("-1");
37 return 0;
38 }
39 sort(lei+1,lei+n+1,cmp);
40 for(int i=1;i<=n;++i)
41 {
42 if(lei[i].begin>now) now=lei[i].end,ans++;
43 }
44 printf("%d",ans);
45 return 0;
46 }