### main

loop do
  n, k = gets.split.map(&:to_i)
  break if (n | k) == 0

  cs = n.times.map{gets.to_i}
  #p cs

  nmk = n - k
  max_ck = 1
  max_ckd = 1

  for i in (0..nmk)
    csi = cs[i, k]
    ck = csi.inject(1){|m, c| m * c}
    max_ck = ck if max_ck < ck

    cds = cs[0, i] + cs[(i + k), nmk - i]
    min_csi = csi.min
    max_cds = cds.max
    ckd = ck * max_cds / min_csi
    max_ckd = ckd if max_ckd < ck
  end
  #p [max_ck, max_ckd]

  puts (max_ckd > max_ck ? max_ckd - max_ck : 0)
end