import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
public class Solution {
    public ArrayList<Integer> FindNumbersWithSum(int [] array,int sum) {
        ArrayList<Integer> ans = new ArrayList<Integer>();
        if(array == null || array.length <= 1) {
            return ans;
        }
        Set<Integer> set = new HashSet<>();
        for(int num : array) {
            if(set.contains(sum - num)) {
                ans.add(num);
                ans.add(sum - num);
                return ans;
            }
            set.add(num);
        }
        return ans;
    }
}