int[] indexK(int []A, int []B, int k){
		int pointers[] = {0,0};
		
		// one array is larger than the other
		if (A[A.length - 1]< B[0]){
			pointers[0] = k-1;
			pointers[1] = -1;
		}
		
		if (A[0] > B[B.length-1]){
			pointers[0] = -1;
			pointers[1] = k-1;
		}
		
		// normal cases
		
		int intervalA[] = {0, A.length};
		while (true){
			adjustPointers(A, B, pointers);
			if (pointers[0] + pointers[1] + 2 < k){
				intervalA[0] = pointers[0];
			}
			
			else if (pointers[0] + pointers[1] > k){
				intervalA[1] = pointers[0];
			}
			
			else {
				if (pointers[0] + pointers[1] + 1 == k){
					pointers[0] = -1;
				}
				else if (pointers[0] + pointers[1] + 2 == k){
					pointers[1] = -1;
				} else{
					System.out.println("error occurs");
				}
				
				break;
			}
			
			pointers[0] = (intervalA[0]+intervalA[1])/2;
		}
		
		return pointers;
	}