Task: Program Execution
Input (English): n, 5491, 4297, K, 3829, 389, M
Output (English): 5491, 4297, 3829, 389