/*
AizuOnline A0000
Title
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n,k,c[10];
int max_teacher,max_student,max_product;
//
void get_max_product()
{
  int i,j,p,m_p;

  //for(i=0;i<n;i++)
  //  printf("%d:",c[i]);

  m_p=0;
  for(i=0;i<=n-k;i++)
    {
      p = 1;
      for(j=0;j<k;j++)
	p *= c[i+j];
      if(p>m_p)
	m_p=p;
    }
  //printf("%d\n",m_p);

  if(m_p > max_product)
    max_product=m_p;
}

main()
{
  int i,j,wk;

  while(EOF != scanf("%d %d",&n,&k) && (n || k))
    {
      for(i=0;i<n;i++)
	scanf("%d",&(c[i]));

      max_product=0;
      
      get_max_product();

      max_teacher=max_product;

      max_product=0;

      for(i=0;i<n-1;i++)
	for(j=i+1;j<n;j++)
	  {
	    wk   = c[i];
	    c[i] = c[j];
	    c[j] = wk;
	    get_max_product();
	    wk   = c[i]; // restore
	    c[i] = c[j];
	    c[j] = wk;
	   
	  }
      max_student=max_product;
      //printf("%d %d\n",max_student , max_teacher);
      //if(max_student > max_teacher)
	printf("%d\n",max_student - max_teacher);
	//else
	//printf("NO GAME\n");
    }
return(0);
}