n, k = gets.split(" ").map(&:to_i)
a = readlines.map(&:to_i)
ans = 0
(1 << a.size).times{ |is|
  max = 0
  b = Array.new
  flg = true
  a.size.times{ |i|
    if(is>>i&1 == 1)
      b.push( (a[i]).to_i )
    end
  }
  if b.size > 1
    0.upto(b.size-2){ |j|
      if (b[j] - b[j+1]).abs > k
        flg = false
        break
      end
    }
  end
  if flg == true
    max = b.size
  end
  if ans < max
    ans = max
  end
}
puts ans