how do you find the maximum sum of a subarray from a given array