while True:
	cards_sum, cards_ind = map(int, input().split())
	if cards_sum == 0 and cards_ind == 0: break
	
	board = []
	for i in range(0, cards_sum):
		board.append(int(input()))
	
	inis = []
	for i in range(0, cards_sum - cards_ind + 1):
		ini = 1
		for ele in board[i: i + cards_ind]:
			ini *= ele
		inis.append(ini)
	ind_nun = inis.index(max(inis))
	
	groupA = []
	groupB = []
	for i in board[ind_nun: ind_nun + cards_ind + 1]:
		groupA.append(i)
	for i in board[0: ind_nun]:
		groupB.append(i)
	for i in board[ind_nun + cards_ind:]:
		groupB.append(i)
		
	if min(groupA) > max(groupB):
		print(0)
	else:
		print(int(max(inis) / min(groupA)) * (max(groupB) - min(groupA)))