Driver code
public static void main ( String [ ] args ) { int N = 4 , K = 25 ; ArrayList < int [ ] > v = new ArrayList < > ( ) ; v . add ( new int [ ] { 10 , 5 } ) ; v . add ( new int [ ] { 20 , 9 } ) ; v . add ( new int [ ] { 12 , 10 } ) ; v . add ( new int [ ] { 4 , 2 } ) ;