#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int n,k;
  int a[100];

  while(cin >> n >> k && (n||k)){
    for(int i=0;i<n;i++)cin >> a[i];

    int ck = 1;
    for(int i=0;i<k;i++)ck *= a[i];
    int m = ck;
    for(int i=k;i<n;i++){
      ck /= a[i-k];
      ck *= a[i];
      m = max(ck,m);
    }
   
    int ans = 0;
    for(int i=0;i+k<=n;i++){
      int x = 1, mi = 100, ma = 0;
      for(int j=0;j<n;j++){
	if(i<=j && j<i+k){
	  mi = min(mi,a[j]);
	  x *= a[j];
	}else ma = max(ma,a[j]);
      } 
      ans = max(ans,x/mi*ma-m);
    }
    cout << ans << endl;
  }
}