#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

int n, k;
vector<int> c;

int solve()
{
    int tmp = 1;
    for(int i=0; i<k; ++i)
        tmp *= c[i];

    int ret = tmp;
    for(int i=k; i<n; ++i){
        tmp /= c[i-k];
        tmp *= c[i];
        ret = max(ret, tmp);
    }

    return ret;
}

int main()
{
    for(;;){
        cin >> n >> k;
        if(n == 0)
            return 0;

        c.resize(n);
        for(int i=0; i<n; ++i)
            cin >> c[i];

        int teacher = solve();
        int student = 0;
        for(int i=0; i<n; ++i){
            for(int j=0; j<i; ++j){
                swap(c[i], c[j]);
                student = max(student, solve());
                swap(c[i], c[j]);
            }
        }

        int ret = student - teacher;
        cout << ret << endl;
    }
}