You are given an array $a$ of length $n$. A subsequence of this array is valid, if it satisfies these two conditions:
- There shouldn't be any two even numbers within a distance of $K$, both which have been chosen in the subsequence. i.e. there shouldn't be two indices $i, j$ such that $a_i$ and $a_j$ are even, $|i - j| \leq K$ and $a_i$ and $a_j$ are in the subsequence. 
- Similarly, there shouldn't be any two odd numbers within a distance of $K$, both which have been chosen in the subsequence
The sum of a subsequence is the sum of all the numbers in it. Your task is find the maximum sum possible in a valid subsequence of the given array. Print this maximum sum.

-----Input-----
- The first line of the input contains an integer $T$ denoting the number of test cases. The description of the test cases follows.
- The first line of each test case contains two space-separated integers $n, k$.
- The second line of each test case contains $n$ space-separated integers denoting the array $a$.

-----Output-----
For each test case, output an integer corresponding to the answer of the problem.

-----Constraints-----
- $1 \le T \le 10^5$
- $1 \le n \leq 10^5$
- $1 \le k \leq  n$
- $1 \le a_i \leq 10^9$
- Sum of $n$ over all the test cases doesn't exceed $10^6$

-----Example Input-----
3
1 1
3
2 1
2 2
5 2
1 2 3 4 6

-----Example Output-----
3
2
11

-----Explanation:-----
Testcase 2: Only one of the two 2s can be chosen. Hence the answer is 2.
Testcase 3: The subsequence containing the second, third and fifth numbers is a valid subsequence, and its sum is 2+3+6 = 11. You can check that this is the maximum possible, and hence is the answer.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'T=int(input())\n\nwhile(T>0):\n N,K=list(map(int,input().split()))\n A=[int(e) for e in input().split()]\n\n \n E=[0]*N\n LE=-1\n LO=-1\n O=[0]*N\n\n\n if(A[0]%2==0):\n  E[0]=A[0]\n  LE=0\n else:\n  O[0]=A[0]\n  LO=0\n\n i=1\n while(i<N):\n  \n  if(A[i]%2==0):\n   O[i]=O[i-1]\n   if(LE!=-1):\n    if(abs(i-LE)<=K):\n     if((i-K-1)>=0):\n      ADDI=E[i-K-1] \n     else:\n      ADDI=0\n      \n      \n     if(E[LE]>=A[i]+ADDI):\n      E[i]=E[LE]\n      LE=LE\n     else:\n      E[i]=A[i]+ADDI\n      LE=i\n    else:\n     E[i]=E[LE]+A[i]\n     LE=i\n\n   else:\n    E[i]=E[i-1]+A[i]\n    LE=i\n  else:\n   E[i]=E[i-1]\n   \n   if(LO!=-1):\n    \n    if(abs(i-LO)<=K):\n     if((i-K-1)>=0):\n      ADDI=O[i-K-1] \n     else:\n      ADDI=0\n      \n     if(O[LO]>=A[i]+ADDI):\n      O[i]=O[LO]\n      LO=LO\n     else:\n      \n      O[i]=A[i]+ADDI\n      LO=i\n    else:\n     O[i]=O[LO]+A[i]\n     LO=i\n \n   else:\n    O[i]=O[i-1]+A[i]\n    LO=i\n  #print(E,O,E[N-1]+O[N-1])\n  \n  i=i+1\n\n\n print(E[N-1]+O[N-1])\n T=T-1\n  \n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13909