------
## 最终结论
```python
def minDifficulty(jobDifficulty, d):
    if d > len(jobDifficulty):
        return -1
    
    n = len(jobDifficulty)
    dp = [[float('inf')] * (d + 1) for _ in range(n + 1)]
    
    # Set the boundary condition for the first day
    for i in range(1, n + 1):
        dp[i][1] = max(jobDifficulty[:i])

    # Fill the dp array
    for j in range(2, d + 1):  # For each day from the second day to d
        for i in range(j, n + 1):  # For each job from j to n
            max_difficulty = 0
            # Try to assign jobs from k to i on day j
            for k in range(i, j - 1, -1):  # Jobs assigned on day j
                max_difficulty = max(max_difficulty, jobDifficulty[k - 1])
                dp[i][j] = min(dp[i][j], dp[k - 1][j - 1] + max_difficulty)

    return dp[n][d] if dp[n][d] != float('inf') else -1
```