import io import sys from collections import defaultdict, deque, Counter from itertools import permutations, combinations, accumulate from heapq import heappush, heappop from bisect import bisect_right, bisect_left from math import gcd import math _INPUT = """\ 6 8 3 1 3 5 6 4 8 9 10 10 10 1 2 3 2 3 2 3 2 1 1 10 5 199178881 932079191 906976560 427573994 961937646 979063146 995030172 852645442 662699738 313858222 """ def input(): return sys.stdin.readline()[:-1] def solve(test): N,K=map(int,input().split()) A=list(map(int,input().split())) B=sorted([(A[i],i) for i in range(N)]) C=sorted([(B[i][1],0 if i