Task: Program Execution
Input (English): N, Q, M, q, 5597, t, 3385, 325, 7521
Output (English): 1, 2, 3, 4, 6