Largest Sum Subarray with At Least k Numbers

Given an array, find the subarray (containing at least k numbers) which has the largest sum. Return the sum.

Examples:

[-4, -2, 1, -3] and k = 2 should return -1. The subarray is [-2, 1].

[1, 1, 1, 1, 1, 1] and k = 2 should return 6. The subarray is [1, 1, 1, 1, 1, 1].

Contributed by Berkan Teber