Driver code
int main ( ) { int arr1 [ 5 ] = { 2 , 3 , 6 , 7 , 9 } ; int arr2 [ 4 ] = { 1 , 4 , 8 , 10 } ; int m = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; int n = sizeof ( arr2 ) / sizeof ( arr2 [ 0 ] ) ; int k = 5 ; int ans = kth ( arr1 , m , arr2 , n , k ) ; if ( ans == -1 ) cout << " Invalid ▁ query " ; else cout << ans ; return 0 ; }