Driver Code
public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 4 , 3 , 2 , 4 , 1 } ; int n = arr . length ; int K = 7 ; int len = subArraylen ( arr , n , K ) ; if ( len == Integer . MAX_VALUE ) { System . out . print ( " - 1" ) ; } else { System . out . print ( len + "NEW_LINE"); } } }