
import kotlin.math.*
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*


private var fs = BufferedReader(InputStreamReader(System.`in`))
private fun readLn() = fs.readLine()!! // string line
private fun readStrings() = readLn().split(" ") // list of strings
private fun readLong() = readLn().toLong()
private fun readLongs() = readStrings().map { it.toLong() } // list of ints
private fun readInt() = readLn().toInt() // single int
private fun readInts() = readStrings().map { it.toInt() } // list of ints
fun main() {
//    val t = readInt()
//    for (tt in 0 until t) {
        solveB()
//    }
//    println("absdaabc")
}
fun solveB() {
    var (N,K) = readInts()
    var ans = 0
    var last = 0
    var bool = false
    var list = mutableListOf<Int>()
    loop@for(i in 1..N){
        var a = readInt()
        if(bool){
            if(abs(a-last) <= K){
                ans++
                last = a
                continue
            }
        }
        else{
            for(j in 0 until list.size){
                if(abs(list[j] - a) <= K){
                    bool = true
                    ans += 2
                    last = a
                    continue@loop
                }
            }
            list.add(a)
        }
    }
    println(ans)
}