class Solution:
    def solve(self , n: int, m: int, a: List[int]) -> List[int]:
    
        def func(i, j):
            while i < j:
                a[i], a[j] = a[j], a[i]
                i += 1
                j -= 1
        m = m % n # 避免过多的移动

        func(0, n-1) # 先整体翻转
        func(0, m-1) # 再翻转前m个
        func(m, n-1) # 最后反转剩下的
        return a