find the pairs returning the given sum in an array