Implement a JS function that takes a list of integers and a target number as input, and returns a array of two integers that add up to the target number.