Fill rest of the elements with 1
for ( int i = P + 1 ; i <= N ; i ++ ) { arr [ i ] = 1 ; } System . out . print ( " The ▁ Minimum ▁ Possible ▁ Sum ▁ is : ▁ " + ans + "NEW_LINE"); System . out . print ( "The Array Elements are: NEW_LINE"); for ( int i = 1 ; i <= N ; i ++ ) { System . out . print ( arr [ i ] + " ▁ " ) ; } }