added sum of an array, and sortByKey function with the required returns
and output