#include <iostream>
#include <algorithm>
using namespace std;

namespace mj {
void search(int *A, int *B, int M, int N, int answer)
{
	if(M > N) return search(B, A, N, M, answer);

    for(int i = 0; i < M; ++i) {
    	int rem = answer - A[i];
    	if( binary_search(B, B+N, rem) ) {
    		cout << answer << " found" << endl;
    		return;
    	}
    }
    cout << answer << " not found" << endl;
}
}

int main() {
	int A[] = {1,2,3,4,5};
	int B[] = {6, 7, 8, 9, 10}; // Assuming both are sorted
	const int M = sizeof A / sizeof A[0];
	const int N = sizeof B / sizeof B[0];

    mj::search(A, B, M, N, 13);
    mj::search(A, B, M, N, 16);

	return 0;
}