Driver Code
int main ( ) { int arr [ ] = { 1 , 2 , 4 , 3 , 2 , 4 , 1 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int K = 7 ; int len = subArraylen ( arr , n , K ) ; if ( len == INT_MAX ) { cout << " - 1" ; } else { cout << len << endl ; } return 0 ; }