#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
using namespace std;
struct point
{
double x,y;
}stl[1005];
struct node
{
double x1,x2;
}cir[1005];
int cmp( point a, point b)
{
if(a.x != b.x)
return a.x<b.x;
return a.y < b.y;
}
int main()
{
int n,d;
int ans = 0;
int count = 0;
while(scanf("%d %d",&n, &d), n != 0 && d != 0)
{
count++;
bool falg = false;
ans = 1;
for( int i = 0; i<n; i++)
scanf("%lf %lf",&stl[i].x, &stl[i].y);
sort(stl,stl+n,cmp);
if(stl[0].y - d > 0 || stl[0].y + d < 0)
falg = true;
cir[0].x1 = stl[0].x - d;
cir[0].x2 = stl[0].x + d;
cir[0].x1 = -(sqrt(d*d - stl[0].y * stl[0].y)) + stl[0].x;
cir[0].x2 = (sqrt(d*d - stl[0].y * stl[0].y)) + stl[0].x;
for( int i = 1; i<n; i++)
{
if(stl[i].y - d > 0 ||stl[i].y + d < 0)
falg = true;
if(falg)
break;
cir[i].x1 = -(sqrt(d*d - stl[i].y * stl[i].y)) + stl[i].x;
cir[i].x2 = (sqrt(d*d - stl[i].y * stl[i].y)) + stl[i].x;
if(cir[i-1].x2 < cir[i].x1)
ans++;
else
{
cir[i].x1 = max(cir[i-1].x1 , cir[i].x1);
cir[i].x2 = min(cir[i-1].x2,cir[i].x2);
}
}
if(!falg)
cout<<"Case "<<count<<": "<<ans<<endl;
else
cout<<"Case "<<count<<": "<<"-1"<<endl;
}
}
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
using namespace std;
struct point
{
double x,y;
}stl[1005];
struct node
{
double x1,x2;
}cir[1005];
int cmp( point a, point b)
{
if(a.x != b.x)
return a.x<b.x;
return a.y < b.y;
}
int main()
{
int n,d;
int ans = 0;
int count = 0;
while(scanf("%d %d",&n, &d), n != 0 && d != 0)
{
count++;
bool falg = false;
ans = 1;
for( int i = 0; i<n; i++)
scanf("%lf %lf",&stl[i].x, &stl[i].y);
sort(stl,stl+n,cmp);
if(stl[0].y - d > 0 || stl[0].y + d < 0)
falg = true;
cir[0].x1 = stl[0].x - d;
cir[0].x2 = stl[0].x + d;
cir[0].x1 = -(sqrt(d*d - stl[0].y * stl[0].y)) + stl[0].x;
cir[0].x2 = (sqrt(d*d - stl[0].y * stl[0].y)) + stl[0].x;
for( int i = 1; i<n; i++)
{
if(stl[i].y - d > 0 ||stl[i].y + d < 0)
falg = true;
if(falg)
break;
cir[i].x1 = -(sqrt(d*d - stl[i].y * stl[i].y)) + stl[i].x;
cir[i].x2 = (sqrt(d*d - stl[i].y * stl[i].y)) + stl[i].x;
if(cir[i-1].x2 < cir[i].x1)
ans++;
else
{
cir[i].x1 = max(cir[i-1].x1 , cir[i].x1);
cir[i].x2 = min(cir[i-1].x2,cir[i].x2);
}
}
if(!falg)
cout<<"Case "<<count<<": "<<ans<<endl;
else
cout<<"Case "<<count<<": "<<"-1"<<endl;
}
}