public int findKth(int[] A, int aStart, int aSize,
			int[] B,int bStart, int bSize, int k) {
		if(aSize == 0) return B[bStart + k - 1];
		if(bSize == 0) return A[aStart + k - 1];
		if(k == 1)
			return Math.min(A[aStart], B[bStart]);
		
		if(aSize >= bSize){
			int ib = Math.min(bSize, k/2);
			int ia = k - ib;
			if(A[aStart + ia - 1] < B[bStart + ib - 1]){
				return findKth(A, aStart + ia, aSize - ia, B, bStart, bSize, k - ia);
			}else if(A[aStart + ia - 1] > B[bStart + ib - 1]){
				return findKth(A, aStart, aSize, B, bStart + ib, bSize - ib, k - ib);
			}else{
				return A[aStart + ia - 1];
			}
		}else{
			int ia = Math.min(aSize, k/2);
			int ib = k - ia;
			if(A[aStart + ia - 1] < B[bStart + ib - 1]){
				return findKth(A, aStart + ia, aSize - ia, B, bStart, bSize, k - ia);
			}else if(A[aStart + ia - 1] > B[bStart + ib - 1]){
				return findKth(A, aStart, aSize, B, bStart + ib, bSize - ib, k - ib);
			}else{
				return A[aStart + ia - 1];
			}
		}
	}