Given an array of integers, write an efficient algorithm to find the longest contiguous subarray with a sum equal to a target value.