#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int a[200];
int chk(int n, int k){
    int ms = 0;
    rep(i,n-k+1){
        int p = 1;
        for(int j=i;j<i+k;j++){
            p *= a[j];
        }
        ms = max(ms, p);
    }
    return ms;
}

int main(){
    int n, k;
    while(cin>>n>>k && n){
        rep(i,n)cin>>a[i];
        int x = chk(n, k);
        int y=0;
        rep(i,n)rep(j,i){
            swap(a[i],a[j]);
            y = max(y,chk(n,k));
            swap(a[i],a[j]);
        }
        cout << y - x << endl;
    }
}