#include <stdio.h>

int card_num;
int cards[100];
int k;

int main(void) {
	int i,j;
	int score_max;
	int maxpos_num;
	int max_pos[100];
	int current_score;
	int minimum_card,max_card;
	int score_max2;
	while(1) {
		scanf("%d%d",&card_num,&k);
		if(card_num==0 && k==0)break;
		for(i=0;i<card_num;i++)scanf("%d",&cards[i]);
		score_max=1;maxpos_num=1;max_pos[0]=0;
		for(i=0;i<k;i++)score_max*=cards[i];
		current_score=score_max;
		for(i=k;i<card_num;i++) {
			current_score*=cards[i];
			current_score/=cards[i-k];
			if(current_score>score_max) {
				score_max=current_score;
				maxpos_num=1;
				max_pos[0]=i-k+1;
			} else if(current_score==score_max) {
				max_pos[maxpos_num++]=i-k+1;
			}
		}
		score_max2=score_max;
		for(i=0;i<maxpos_num;i++) {
			minimum_card=100;
			for(j=0;j<k;j++) {
				if(cards[max_pos[i]+j]<minimum_card) {
					minimum_card=cards[max_pos[i]+j];
				}
			}
			max_card=minimum_card;
			for(j=0;j<card_num;j++) {
				if(j==max_pos[i])j+=k;
				if(cards[j]>max_card)max_card=cards[j];
			}
			current_score=score_max*max_card/minimum_card;
			if(current_score>score_max2)score_max2=current_score;
		}
		printf("%d\n",score_max2-score_max);
	}
	return 0;
}