In Programmers Army Land, people have started preparation as sports day is scheduled next week.
You are given a task to form 1 team of $k$ consecutive players, from a list of sports player whose powers are given to you.
You want your team to win this championship, so you have to chose your $k$ team players optimally i.e. there must not be any other $k$ consecutive team players who have their total power greater than your team members total power.

-----Input:-----
- The first line of the input contains a single integer $T$. $T$ denoting the number of test cases. The description of $T$ test cases is as follows.
- The next line of the input contains 2 space separated integers $N$ and $K$. $N$ denotes the total number of players and $K$ denotes the number of players allowed in a team.
- The next line of the input contains $N$ space-separated integers $A1, A2, A3...An$ where $ith$ number denotes power of $ith$ player.
Note: power of players can also be negative

-----Output:-----
- For each test-case print the total power that your selected team have(each test case output must be printed on a new line).

-----Constraints:-----
- $1 \leq T \leq 10^3$
- $1 \leq N,K \leq 10^5$
- $-10^7 \leq A1, A2, A3...An \leq 10^7$

-----Sample Input:-----
1
5 3
1 2 3 4 5

-----Sample Output:-----
12

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
def func(arr, k):
    sumi = 0
    for j in range(k):
        sumi += arr[j]
    maxi = sumi
    for i in range(k,len(arr)):
        sumi -= arr[i - k]
        sumi += arr[i]
        maxi = max(maxi,sumi)
    return maxi
for _ in range(int(input())):
    n, k = map(int,input().split())
    arr = [int(x) for x in input().split()]
    print(func(arr,k))

def call(lst,m):
    maxsum= sum(lst[0:m])
    j=0
    maxs=0
    for i in range(m,len(lst)):
        maxs = max(maxsum,maxs)
        #print(maxsum,lst[j],lst[i])
        maxsum -= lst[j]
        maxsum += lst[i]
        j = j+1
    maxs = max(maxsum,maxs)
    return maxs
t = int(input())
while(t):
    t = t-1
    n,m = map(int,input().split())
    lst = list(map(int,input().split()))
    print(call(lst,m))

def maxSum(arr, n, k): 
    res = 0
    for i in range(k): 
        res += arr[i] 
    curr_sum = res 
    for i in range(k, n): 
        curr_sum += arr[i] - arr[i-k] 
        res = max(res, curr_sum) 
    return res 
for i in range(int(input())):
    n,k=map(int,input().split())
    arr=list(map(int,input().split()))
    print(maxSum(arr,n,k))

ncases = int(input())

for cases in range(ncases):
    players, selected = list( map( int, input().split()))
    powerlist = list( map( int, input().split()))
    currmax = sum(powerlist[:selected])
    change = 0
    for i in range(selected, players):
        change += powerlist[i]
        change -= powerlist[i - selected]
        if change > 0:
            currmax += change
            change = 0
    print(currmax)

# cook your dish here
def maxSum(arr, n, k): 
	res = 0
	for i in range(k): 
		res += arr[i] 
	curr_sum = res 
	for i in range(k, n): 
		curr_sum += arr[i] - arr[i-k] 
		res = max(res, curr_sum) 
	return res 
for _ in range(int(input())):
    N, K = map(int, input().split(" "))
    lst = list(map(int, input().split(" ")))
    print(maxSum(lst, N, K))

def maxSum(arr, n, k): 
	res = 0
	for i in range(k): 
		res += arr[i] 
	curr_sum = res 
	for i in range(k, n): 
		curr_sum += arr[i] - arr[i-k] 
		res = max(res, curr_sum) 
	return res 
for _ in range(int(input())):
    N, K = map(int, input().split(" "))
    lst = list(map(int, input().split(" ")))
    print(maxSum(lst, N, K))

# cook your dish here

def check(A,N,K):
    first = sum(A[:K])
    mx = sum(A[:K])
    for i in range(K,N):
        cur = first - A[i-K] + A[i]
        if(cur>mx):
            mx = cur
            first = cur
        else:
            first = cur
    return(mx)
        
    


t = int(input())
for _ in range(t):
    n,k = map(int,input().split())
    arr = list(map(int,input().split()))
    print(check(arr,n,k))

for _ in range(int(input())):
    n,q=list(map(int,input().split()))
    a=list(map(int,input().split()))
    maxs=sum(a[:q])
    temp=maxs
    for i in range(q,n):
        temp=temp+a[i]-a[i-q]
        maxs=max(maxs,temp)
    print(maxs)


for _ in range(int(input())):
    n, k = list(map(int, input().split()))
    arr = list(map(int, input().split()))
    mx = sum(arr[0:min(k, n)])
    curr = mx
    for i in range(0, n-k):
        curr += arr[i+k]-arr[i]
        mx = max(mx, curr)
    print(mx)



def maxSum(arr, n, k):
    # k must be greater
    if (n < k):
        print("Invalid")
        return -1

    # Compute sum of first
    # window of size k
    res = 0
    for i in range(k):
        res += arr[i]

        # Compute sums of remaining windows by
    # removing first element of previous
    # window and adding last element of
    # current window.
    curr_sum = res
    for i in range(k, n):
        curr_sum += arr[i] - arr[i - k]
        res = max(res, curr_sum)

    return res

for _ in range(int(input())):
    n,k=list(map(int,input().split()))
    l=list(map(int,input().split()))
    print(maxSum(l, n, k))



# cook your dish here
t =int(input())
while t>0:
    N,K = map(int,input().split())
    std_pow = list(map(int,input().split()))
    max_sum = sum(std_pow[:K])
    k12 = max_sum
    z=0
    # print(max_sum)
    for i in range(K,N):
        # print("index is "+str(i))
        k12 = k12 + std_pow[i] - ((std_pow[z]))
        # print(k12)
        z=z+1
        if k12>max_sum:
            max_sum=k12
            
    print(max_sum)        
    t=t-1

# cook your dish here
def func(a):
    S_max=0
    for i in range(0,k):
        S_max+=a[i]
    s=S_max
    for i in range(k,n):
        s+=a[i]-a[i-k]
        S_max=max(S_max,s)

    return S_max

t=int(input())
for i in range(t):
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    print(func(a))

# cook your dish here
import sys
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_list(): return list(map(int, sys.stdin.readline().strip().split()))
def get_list_string(): return list(map(str, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip()
def get_int(): return int(sys.stdin.readline().strip())
def get_print_int(x): sys.stdout.write(str(x) + '\n')
def get_print(x): sys.stdout.write(x + '\n')

def solve():
    for _ in range(get_int()):
        n,k = get_ints()
        arr = get_list()
        pre = 0
        s=0
        for i in range(k):
            pre += arr[i]
        ans = pre
        for i in range(k,n,1):
            pre = pre + arr[i] - arr[s]
            s += 1
            ans = max(ans,pre)
        get_print_int(ans)
solve()

t = int(input())
ans = []

for _ in range(t):
    n,k = [int(x) for x in input().split(' ')]
    arr = [int(x) for x in input().split(' ')]
    curr = sum(arr[0:k])
    best = curr
    for i in range(n-k):
        curr = curr-arr[i]+arr[i+k]
        if(curr>best):
            best = curr
    ans.append(best)
        
for i in ans:
    print(i)


for _ in range(int(input())):
    n,k = map(int,input().split())
    arr = list(map(int,input().split()))
    s = sum(arr[:k])
    m = s
    for i in range(1,n-k+1):
        s = s-arr[i-1]+arr[i+k-1]
        if s>m: m=s
    print(m)

# cook your dish here
t=int(input())
for _ in range(t):
    n, k = map(int, input().split())
    array=list(map(int, input().split()))
    massimo=sum(array[:k])
    appo=massimo
    for i in range(n-k):
        appo+=array[k+i]-array[i]
        massimo=max(massimo,appo)
    print(massimo)

from sys import stdin

# Input data
#stdin = open("input", "r")


for _ in range(int(stdin.readline())):
    n, k = list(map(int, stdin.readline().split()))
    arr = list(map(int, stdin.readline().split()))
    ans = sum(arr[:k])
    s = sum(arr[:k])
    for i in range(k, n):
        s += arr[i]
        s -= arr[i - k]
        ans = max(ans, s)
    print(ans)


for _ in range(int(input())):
    n,k = list(map(int,input().split()))
    pows = list(map(int,input().split()))
    if k == 1 :
        print(max(pows))
        continue
    arr = []
    lastsum = None
    for i in range(n-k+1) :
        if lastsum is None :
            lastsum = sum(pows[:k])
            arr.append(lastsum)
        else :
            lastsum += pows[i+k-1] - pows[i-1]
            arr.append(lastsum)
    # print(arr)
    print(max(arr))


for _ in range(int(input())):
    n,k = list(map(int,input().split()))
    p = list(map(int,input().split()))
    window_sum = sum(p[:k])
    max_sum = window_sum
    for i in range(n-k):
        window_sum = window_sum-p[i]+p[i+k]
        max_sum = max(window_sum,max_sum)
    print(max_sum)


def main():
    for _ in range(int(input())):
        n,k=list(map(int,input().split()))
        a=list(map(int,input().split()))
        s=sum(a[:k])
        m=s
        for i in range(k,n):
            m=max(m,s+a[i]-a[i-k])
            s=s+a[i]-a[i-k]
        print(m)
main()

from sys import stdin, stdout
input = stdin.readline
print2 = stdout.write
def get_ints(): return map(int, stdin.readline().split())
def get_list(): return list(map(int, stdin.readline().split()))
for _ in range(int(input())):
	n, k = get_ints()
	powers = get_list()
	s = sum(powers[0:k])
	ma = s
	i = 1
	while i + k - 1 < n:
		s = s - powers[i-1] + powers[i+k-1]
		ma = max(s, ma)
		i += 1
	print(ma)

# cook your dish here
for t in range(int(input())):
    n,k=map(int,input().split())
    a=[int(i) for i in input().split()]
    s=sum(a[:k])
    minn=s
    for i in range(1,n-k+1):
        s=s-a[i-1]+a[i+k-1]
        if s>minn:
            minn=s
    print(minn)

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


def maxSum(arr, n, k): 
	if (n < k): 
	
		print("Invalid") 
		return -1
	res = 0
	for i in range(k): 
		res += arr[i] 
	curr_sum = res 
	for i in range(k, n): 
		curr_sum += arr[i] - arr[i-k] 
		res = max(res, curr_sum) 
	return res 
for _ in range(int(input())):
    n,k=[int(x) for x in input().split()]
    arr=list(map(int,input().split()))
    print(maxSum(arr, n, k)) 


t = int(input())

for _ in range(t):

	n, k = list(map(int, input().split()))

	a = list(map(int, input().split()))

	test = sum(a[i] for i in range(k))

	win = test

	for i in range(k, n):

		test = test - a[i-k] + a[i]

		if test > win:
			win = test

	print(win)