#include<stdio.h>
int main(){
  int n,k,s,d[100],mx,max,min,i,j,ans,b;
  while(scanf("%d %d",&n,&k),n||k){
    s=1;
    for(i=ans=mx=0;i<n;i++){
      scanf("%d",&d[i]);
      s*=d[i];
      if(i<k-1)continue;
      if(mx<s)mx=s;
      s/=d[i-k+1];
    }//printf("%d\n",mx);
    for(i=b=0;i+k-1<n;i++){//printf("b%d ",b);
      min=20;
      s=1;
      for(j=0;j<k;j++){
	if(min>d[i+j])min=d[i+j];
	s*=d[i+j];
      }
      for(max=0;i+j<n;j++){
	if(max<d[i+j])max=d[i+j];
      }//printf("%d ",max);
      if(max<b)max=b;
      s=s/min*max;//printf("s%d\n",s);
      if(ans<s-mx)ans=s-mx;
      if(b<d[i])b=d[i];
    }
    printf("%d\n",ans);
  }
  return 0;
}