use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let k: i64 = read();
    let mut a: Vec<i64> = (0..n).map(|_| read()).collect();
    let mut a2 = a.clone();
    a2.sort();
    let mid = a2[n / 2];
    let index_mid = a.iter().position(|&x| x == mid).unwrap();
    let mut ng = 0;
    for i in index_mid..n-1 {
        if (a[i] - a[i+1]).abs() > k {
            ng += 1;
            a[i+1] = a[i];
        }
    }
    for i in (1..=index_mid).rev() {
        if (a[i] - a[i-1]).abs() > k {
            ng += 1;
            a[i-1] = a[i];
        }
    }
    println!("{}", n - ng);
}
