-----
ARRAY AND DISTINCT ELEMENTS
-----
Chef is multitalented but he mistakenly took part in 2 contest which will take place
at the same time. So while chef is busy at one cooking contest, he wants you to
take part in coding contest. Chef wants u to solve this program for him.
You have been given an array of size n. You have to calculate a subarray of size k
with maximum sum having distinct elements same as original array.
-----Input Format-----
First line contains no. of test cases. Second line contains n and k. Third line
contains array of n integers.
-----Output-----
Print maximum possible sum as stated in question
-----Example Text Case-----
Input:
1
10 6
8 8 3 5 3 8 5 7 7 7
Output:
37

# cook your dish here
for u in range(int(input())):
 n,k=list(map(int,input().split()))
 l=list(map(int,input().split()))
 m=0
 s=set(l)
 r=len(s)
 for i in range(n-k+1):
  c=0
  d=set()
  for j in range(i,i+k):
   c+=l[j]
   d.add(l[j])
  if(len(d)==r):
   m=max(m,c)
 print(m)

# cook your dish here
for u in range(int(input())):
 n,k=list(map(int,input().split()))
 l=list(map(int,input().split()))
 m=0
 s=set(l)
 r=len(s)
 for i in range(n-k+1):
  c=0
  d=set()
  for j in range(i,i+k):
   c+=l[j]
   d.add(l[j])
  if(len(d)==r):
   m=max(m,c)
 print(m)
