Task: Program Execution
Input (English): N, 5885, 3943, x, 651, 2547, 9641, g, M
Output (English): 2, 3, 5, 6, 7