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

cs = (1..n.to_i).map{
  STDIN.gets
}.map(&:chomp).map(&:to_i)


cd = (0..(cs.length - k)).map{|m| cs[m..(m + k - 1)].inject(:*)}.max

ck = cs.sort.reverse[0..k-1].inject(:*)

puts ck == cd ? 0 : ck - cd