Language: C++

#include <iostream>
#include <vector>
#include <unordered_set>

using namespace std;

int main(int argc, char **argv)
{
	int nLength, nRequests;

	cin >> nLength >> nRequests;

	vector<int> tmpRequests;
	tmpRequests.reserve(nRequests);

	for (int i = 0; i < nRequests; i++)
	{
		int query;
		cin >> query;
		tmpRequests.push_back(query);
	}

	vector<int> requestVec;
	unordered_set<int> requestSet;

	requestVec.reserve(nRequests);
	requestSet.reserve(nRequests);

	for (int i = 0; i < nRequests; i++)
	{
		int query = tmpRequests[nRequests - 1 - i];

		if (find(requestSet.begin(), requestSet.end(), query) == requestSet.end())
		{
			requestVec.push_back(query);
			requestSet.insert(query);
		}
	}

	//cerr << "request size: " << requestVec.size() << endl;
	//for (int i = 0; i < requestVec.size(); i++)
	//	cerr << requestVec[i] << " ";
	//cerr << endl;

	//cerr << "request size: " << requestSet.size() << endl;
	//for (const auto val : requestSet)
	//	cerr << val << " ";
	//cerr << endl;

	for (int i = 0; i < (int)requestVec.size(); i++)
		cout << requestVec[i] << endl;

	for (int i = 1; i <= nLength; i++)
	{
		if (find(requestSet.begin(), requestSet.end(), i) == requestSet.end())
			cout << i << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:33:25: error: no matching function for call to 'find(std::unordered_set<int>::iterator, std::unordered_set<int>::iterator, int&)'
   33 |                 if (find(requestSet.begin(), requestSet.end(), query) == requestSet.end())
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:33:25: note:   'std::__detail::_Node_iterator<int, true, false>' is not derived from 'std::istreambuf_iterator<_CharT>'
   33 |                 if (find(requestSet.begin(), requestSet.end(), query) == requestSet.end())
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:25: error: no matching function for call to 'find(std::unordered_set<int>::iterator, std::unordered_set<int>::iterator, int&)'
   55 |                 if (find(requestSet.begin(), requestSet.end(), i) == requestSet.end())
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:55:25: note:   'std::__detail::_Node_iterator<int, true, false>' is not derived from 'std::istreambuf_iterator<_CharT>'
   55 |                 if (find(requestSet.begin(), requestSet.end(), i) == requestSet.end())
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~