Task: Program Execution
Input (English): N, Q, 1979, r, 1701, B, c, 6525, 9955, j, u, 5161, 7097, 5331, P, G, 9005, k, a, 9731, g, S, K, 4311
Output (English): 1, 2, 4, 6, 7, 10, 11, 15, 16, 18, 19, 21, 22, 23