#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (cin >> n >> k, n || k) {
    map<int, int> mp;
    int a[200];
    priority_queue<int> q;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      q.push(a[i]);
    }
    int ckd = 0;
    for (int i = 0; i < n - k + 1; i++) {
      int m = 1;
      for (int j = 0; j < k; j++) {
        m *= a[i + j];
      }
      ckd = max(ckd, m);
    }
    int ck = 1;
    for (int i = 0; i < k; i++) {
      ck *= q.top();
      q.pop();
    }
    cout << ck - ckd << endl;
  }
  return 0;
}
