object Main extends App {

  import scala.io.StdIn._
  val Array(n, r) = readLine.trim.split(' ').map(_.toDouble)
  val points = Array.fill(n.toInt){
    val Array(x, y) = readLine.trim.split(' ').map(_.toDouble)
    Coordinate(x, y)
  }.sortBy(_.x)
  val uft = new UnionFind(n.toInt)
  merge(points.indices.toArray)
  println(points.indices.count(i ⇒ uft.find(i) == i))
  def merge(rest: Array[Int]): Array[Int] = {
    if (rest.length <= 3) {
      for (i ← rest.indices; j ← 0 until i) {
        if (points(rest(i)).distance(points(rest(j))) <= 2 * r) {
          uft.unite(rest(i), rest(j))
        }
      }
      rest.filter(i ⇒ uft.find(i) == i)
    }else {
      val mid = points(rest(rest.length / 2)).x
      val merged = (merge(rest.take(rest.length / 2)) ++ merge(rest.drop(rest.length / 2))).filter(i ⇒ math.abs(points(i).x - mid) <= 1.1 * r).sortBy(i ⇒ points(i).y)
      if (merged.length >= 2) {
        for (i ← merged.indices.tail) {
          if (points(merged(i)).distance(points(merged(i - 1))) <= 2 * r) uft.unite(merged(i), merged(i - 1))
        }
      }
      rest.filter(i ⇒ uft.find(i) == i)
    }
  }
}
class UnionFind(size: Int) {
  private[this] val parent = Array.fill(size){-1}
  def find(a: Int): Int = {
    if (parent(a) < 0) a
    else {
      parent(a) = find(parent(a))
      parent(a)
    }
  }
  def isSame(a: Int, b: Int): Boolean = find(a) == find(b)
  def unite(a: Int, b: Int): Unit = {
    val ar = find(a)
    val br = find(b)
    if (ar != br) {
      if (parent(ar) < parent(br)) {
        parent(ar) += parent(br)
        parent(br) = ar
      }else {
        parent(br) += parent(ar)
        parent(ar) = br
      }
    }
  }
}
case class Coordinate(x: Double, y: Double) {
  def distance(that: Coordinate): Double = math.sqrt((x - that.x) * (x - that.x) + (y - that.y) * (y - that.y))
}
