Task: Program Execution
Input (English): 9627, 7261, 7329, N, M
Output (English): 2