#include <bits/stdc++.h>
int main() {
  int n, k;
  while (scanf("%d %d", &n, &k), n || k) {
    int max = 0, m = 0, min = 101, s = 1, i, mi;
    int d[101];
    for (i = 0; i < n; i++) {
      scanf("%d", &d[i]);
      s *= d[i];
      if (i >= k) s /= d[i - k];
      if (max < s) {
        max = s;
        mi = i;
      }
    }
    for (i = 0; i < k; i++) {
      if (min > d[mi - i]) min = d[mi - i];
    }
    for (i = 0; i < mi - k + 1; i++) {
      if (m < d[i]) m = d[i];
    }
    for (i = mi + 1; i < n; i++) {
      if (m < d[i]) m = d[i];
    }
    if (min < m)
      printf("%d\n", (m * max / min) - max);
    else
      printf("0\n");
  }
  return 0;
}
