require 'pp'
def update(id)
  update id*2+1 if id < $tree.size-$n
  update id*2+2 if id < $tree.size-$n
  $tree[id] = [$tree[id*2+1], $tree[id*2+2]].min if id < $tree.size-2**($num-1)
end

def query (a, b, k, l, r)
  return Float::INFINITY if r<= a || b <= l
  return $tree[k] if a <= l && r<= b
  vl = query(a, b, k*2+1, l, (l+r)/2)
  vr = query(a, b, k*2+2, (l+r)/2, r)
  #puts "vl:#{vl} vr:#{vr}"
  #puts
  return [vl,vr].min
end

$n,$l  = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
$num = 0
$tree = []
flag = false
while true
  if 2**$num < as.size
    (2**$num).times{|i|
      $tree << Float::INFINITY
    }
  else
    as.each{|a| $tree << a}
    (2**$num-$n).times{$tree << Float::INFINITY}
  end
  $num+=1
  break  if flag
  flag = true if 2**$num >= as.size
end
size2 = $tree.size - 2**($num-1)
update 0
min = []

m=1
while m<$n
  m*=2
end
#pp $tree
($n-$l+1).times{|i|
  #puts "l:#{size2+i} r::#{size2+i+$l-1}"
  min << query(i, i+$l,  0, 0, m)
}

puts min.join(" ")

