This dp array is used to store our values so that we don 't have to calculate same  values again and again
var dp = Array ( MAX_INDEX ) . fill ( ) . map ( ( ) => Array ( MAX_SUM ) . fill ( ) . map ( ( ) => Array ( MAX_INDEX ) . fill ( 0 ) ) ) ; ; function waysutil ( index , sum , count , arr , K ) {