I found an interesting problem on https://leetcode.com/problems/make-array-strictly-increasing/:
Given two integer arrays arr1 and arr2, return the minimum number of operations (possibly zero) needed to make arr1 strictly increasing.
In one operation, you can choose two indices 0 <= i < arr1.length and 0 <= j < arr2.length and do the assignment arr1[i] = arr2[j].
If there is no way to make arr1 strictly increasing, return -1.
 
Example 1:
Input: arr1 = [1,5,3,6,7], arr2 = [1,3,2,4]
Output: 1
Explanation: Replace 5 with 2, then arr1 = [1, 2, 3, 6, 7].

Example 2:
Input: arr1 = [1,5,3,6,7], arr2 = [4,3,1]
Output: 2
Explanation: Replace 5 with 3 and then replace 3 with 4. arr1 = [1, 3, 4, 6, 7].

Example 3:
Input: arr1 = [1,5,3,6,7], arr2 = [1,6,3,3]
Output: -1
Explanation: You can't make arr1 strictly increasing.
 
Constraints:

1 <= arr1.length, arr2.length <= 2000
0 <= arr1[i], arr2[i] <= 10^9

I tried it in Python, but could not do it. Can you solve it?
import bisect

class Solution:
    def makeArrayIncreasing(self, arr1: List[int], arr2: List[int]) -> int:
        N = len(arr1)
        arr1 = [0] + arr1
        # 表示前 i 个元素，执行了 k 次操作后，是有序的
        dp = [[float('inf')] * (N + 1) for _ in range(N + 1)]
        dp[0][0] = -float('inf')
        
        arr2.sort()
        for i in range(1, N + 1):
            for k in range(i + 1):
                # 前i-1个元素，已经完成了k次交换
                if arr1[i] > dp[i-1][k]:
                    dp[i][k] = min(dp[i][k], arr1[i])
                
                # 前 i-1 个元素，已经完成了 k-1次交换，所以这一次一定要交换
                if k >= 1:
                    idx_2 = bisect.bisect_right(arr2, dp[i-1][k-1])
                    if idx_2 != len(arr2):                    
                        dp[i][k] = min(dp[i][k], arr2[idx_2])
        
        res = float('inf')
        for i in range(1, N+1):
            if dp[N][i] != float('inf'):
                res = min(res, i)
        return res if res != float('inf') else -1