function FindNumbersWithSum(array, sum)
{
    // write code here
    var i = 0;
    var j = array.length - 1
    var result = []
    while(i<j) {
        if(array[i] + array[j] ==sum) {
            if(result.length == 0) {
                result = [array[i], array[j]]
            } else if((result[0]*result[1])>(array[i]*array[j])) {
                result = [array[i], array[j]]
            }
            i++
        } else if (array[i]+array[j]>sum) {
            j--
        } else {
            i++
        }
    }
    return result
}
module.exports = {
    FindNumbersWithSum : FindNumbersWithSum
};