Task: Program Execution
Input (English): m, N, z, 8909, 3371, 9563, 1947, 3279, J, 4229
Output (English): 1, 2, 3, 9