------
## 最终结论
```python
def splitArray(nums, m):
    left = max(nums)
    right = sum(nums)

    def canSplit(maxSum):
        count = 1
        currentSum = 0
        
        for num in nums:
            currentSum += num
            if currentSum > maxSum:
                count += 1
                currentSum = num
                
                if count > m:
                    return False
        
        return True

    while left < right:
        mid = (left + right) // 2
        if canSplit(mid):
            right = mid
        else:
            left = mid + 1

    return left

# Example usage:
nums = [7,2,5,10,8]
m = 2
print(splitArray(nums, m))  # Output: 18
```