n,k=gets.chomp.split.map(&:to_i)

arr = []
n.times do
  arr << gets.chomp.to_i
end

min_n = 0
new_arr = []
new_arr << arr[0][0]
arr.each_with_index do |a, i|
  if i != 0
    if (new_arr.last - a).abs <= k
      new_arr << a
    end
  end
end

p new_arr.length