------
## 最终结论
```python
def maxSubArraySum(arr, k):
    # Initialize variables
    current_sum = 0
    max_sum = float('-inf')  # Use negative infinity to initialize max sum

    # Traverse the array to find the maximum subarray sum
    for num in arr:
        current_sum += num
        max_sum = max(max_sum, current_sum)
        if current_sum < 0:
            current_sum = 0  # Reset current sum if it's negative

    # Calculate prefix and suffix sums
    prefix_sum = 0
    temp_prefix_sum = 0
    for i in range(len(arr)):
        temp_prefix_sum += arr[i]
        prefix_sum = max(prefix_sum, temp_prefix_sum)

    suffix_sum = 0
    temp_suffix_sum = 0
    for i in range(len(arr) - 1, -1, -1):
        temp_suffix_sum += arr[i]
        suffix_sum = max(suffix_sum, temp_suffix_sum)

    total_array_sum = sum(arr)

    if k == 1:
        return max(max_sum, 0) % (10**9 + 7)
    
    # If k > 1, calculate the maximum subarray sum considering full arrays
    if total_array_sum > 0:
        return max(max_sum, 
                   prefix_sum + (k - 2) * total_array_sum + suffix_sum,
                   0) % (10**9 + 7)
    
    return max(max_sum, prefix_sum + suffix_sum, 0) % (10**9 + 7)

# Example usage:
print(maxSubArraySum([1,2], 3))      # Output: 9
print(maxSubArraySum([1,-2,1], 5))   # Output: 2
print(maxSubArraySum([-1,-2], 7))    # Output: 0
```