Array to store return values
let ans = getSubArray ( arr , n , K ) ; if ( ans [ 0 ] == - 1 ) { document . write ( " " + " " ) ; } else { for ( let i = ans [ 0 ] ; i <= ans [ 1 ] ; i ++ ) document . write ( arr [ i ] + " " ) ; }