':type nums: List[int]
:type k: int
:rtype: int'

def maxSubArrayLen(self, nums, k):

    sums = {}
    (cur_sum, max_len) = (0, 0)
    for i in xrange(len(nums)):
        cur_sum += nums[i]
        if (cur_sum == k):
            max_len = (i + 1)
        elif ((cur_sum - k) in sums):
            max_len = max(max_len, (i - sums[(cur_sum - k)]))
        if (cur_sum not in sums):
            sums[cur_sum] = i
    return max_len
