Language: C++

#include <iostream>
#include <vector>
#include <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;
	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);
		}
	}

	for (int i = 0; i < 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:27:20: error: 'class std::set<int>' has no member named 'reserve'
   27 |         requestSet.reserve(nRequests);
      |                    ^~~~~~~
a.cc:33:25: error: no matching function for call to 'find(std::set<int>::iterator, std::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::_Rb_tree_const_iterator<int>' is not derived from 'std::istreambuf_iterator<_CharT>'
   33 |                 if (find(requestSet.begin(), requestSet.end(), query) == requestSet.end())
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:45:25: error: no matching function for call to 'find(std::set<int>::iterator, std::set<int>::iterator, int&)'
   45 |                 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:45:25: note:   'std::_Rb_tree_const_iterator<int>' is not derived from 'std::istreambuf_iterator<_CharT>'
   45 |                 if (find(requestSet.begin(), requestSet.end(), i) == requestSet.end())
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~