use proconio::{fastout, input};
use std::cmp;

#[fastout]
fn main() {
    input! {
        n: usize,
        k: u64,
        r#as: [u64; n],
    }

    let mut ans = 0;
    let mut unvisited = (0..n).collect::<Vec<_>>();
    while !unvisited.is_empty() {
        let mut cur = 1;
        let mut next = vec![];
        let mut a = r#as[unvisited[0]];

        for &i in &unvisited[1..] {
            if diff(a, r#as[i]) <= k {
                a = r#as[i];
                cur += 1;
            } else {
                next.push(i);
            }
        }

        ans = cmp::max(ans, cur);
        unvisited = next;
    }

    println!("{}", ans);
}

fn diff(a: u64, b: u64) -> u64 {
    cmp::max(a, b) - cmp::min(a, b)
}
