Please act as an experienced software engineer hands on skill in JavaScript, write human written code in JavaScript, use proper coding standards, to write and fix the code, I'll give you input points to write the code using all of those points, sunny and johnny like pool their money and go to the ice cream parlor. Johnny never buys the same flavor that sunny does. The only other rule they have is that they spend all of their money. 
Given a list of prices for the flavors of ice cream, select what two that will cost all the money they have.

For example, they have m = 6 to spend and there sre flavors costing cost = [1,3,4,5,6]. The two flavors costing 1 and 5 meet criteria, Using 1-based indexing, they are at indices 1 and 4

Function description ; 

Complete the icecreamParlor in the below, It should return an array containing the indices of the prices of the two flavors they buy, sorted ascending

icecreamParlor has the following parameter(s);

m:  an integer denoting the amount of money they have to spend.

cost: an integer array denoting the cost of each flavor of ice cream

Here are how answer should be : 

Return type shoiul be object

icecreamParlor(4,[6,3,5,1,2]) should return [2,4]

icecreamParlor(4,[1,4,5,3,2]) should return [1,4]

Answer should be valid for any given input

Here is the incomplete code : 

function icecreamParlor(m, arr){
return false;
}

icecreamParlor(4,[6,3,5,1,2]);