#include <iostream>
#include <algorithm>

using namespace std;

int main( void )
{
	int n, k;
	int map[100];
	while(cin >> n >> k, n | k) {
		for(int i=0; i < n; ++i) cin >> map[i];
		int point1 = map[0];
		int nn = n - k + 1;
		for(int i=0; i < nn; ++i) {
			int mul = 1, nnn = i + k;
			for(int j=i; j < nnn; ++j) {
				mul *= map[j];
			}
			point1 = max(point1, mul);
		}
		int point2 = point1;
		for(int i=0; i < nn; ++i) {
			int nnn = i + k, max_num = 0;
			for(int j=0; j < n; ++j) {
				if(i <= j && j < nnn) continue;
				max_num = max(max_num, map[j]);
			}
			int mul = 1, min_num = 16;
			for(int j=i; j < nnn; ++j) {
				mul *= map[j];
				min_num = min(min_num, map[j]);
			}
			point2 = max(point2, mul / min_num * max_num);
		}
		cout << point2 - point1 << endl;
	}

	return 0;
}