#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }

int main() {
	cin.tie(false);
	ios::sync_with_stdio(false);

	for(int n, k; cin >> n >> k, n | k;) {
		vector<int> c(n);
		for(int i = 0; i < n; ++i)
			cin >> c[i];

		int current = 0;
		for(int i = 0; i < n; ++i)
			chmax(current, c[i] * c[i + 1]);

		int change = 0;
		for(int i = 0; i < n; ++i)
			for(int j = i + 1; j < n; ++j)
				chmax(change, c[i] * c[j]);

		cout << change - current << endl;
	}
	

	return EXIT_SUCCESS;
}