n, k = gets.chomp.split(' ').map(&:to_i)
aa = Array.new(n) { gets.chomp.to_i }

dp = [1]
1.upto(n - 1) do |i|
    dp[i] = dp[i - 1]
    j = i - 1
    while j >= 0 && dp[j] == dp[i - 1] do
        # puts "aa[#{i}] = #{aa[i]}, aa[#{j}] = #{aa[j]}"
        if (aa[j] - aa[i]).abs <= k then
            dp[i] += 1
            break
        end
        j -= 1
    end
    # puts "i = #{i}, dp[i] = #{dp[i]}"
end
puts dp[n - 1]