5097. 회전 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 import sys sys.stdin = open("5097.txt", "r") T = int(input()) for tc in range(1,T+1): N, M = list(map(int,input().split())) nlst = list(map(int,input().split())) cnt = 1 while True: temp = nlst.pop(0) nlst.append(temp) cnt += 1 if cnt == M: break print("#{} {}".format(tc, nlst[1])) # ### # for i in range(M): # data ..