N, K = gets.split.map(&:to_i)
a_n = N.times.map{|_| gets.to_i}

ans = 0
a = a_n[0]
(1...N).each do |i|
  if ans == 0
    if (a - a_n[i]).abs <= K
      ans = 2
    end
    a = a_n[i]
  elsif (a - a_n[i]).abs <= K
    ans += 1
    a = a_n[i]
  end
end
p [ans, 1].max