Driver code
public static void main ( String [ ] args ) { int N = 10 , k = 2 ; int arr [ ] = { 50 , 70 , 40 , 50 , 90 , 70 , 60 , 40 , 70 , 50 } ; System . out . println ( maxSum ( arr , N , k ) ) ; } }