Solve a problem using the Sliding Window technique.
Implement max_sum_subarray(nums, k), which returns the maximum sum among all contiguous subarrays of length k. The input is an integer array nums and a valid positive integer k; return an integer. For nums = [2, 1, 5, 1, 3, 2] and k = 3, return 9, from [5, 1, 3]. For nums = [-4, -2, -7] and k = 2, return -6, from [-4, -2].
def max_sum_subarray(nums, k):