Memory managers are parts of operating systems and programming systems that manage memory allocation, deallocation, and optimize memory resources for processes. The lowest level of managers operates with pages of physical memory – fix-sized blocks of the same length, into which the entire available address space is divided.
Page managers must work very quickly and implement extremely simple algorithms. Develop a simple page manager that works according to the following rules:
The first line contains two numbers $$$n$$$ $$$(0 \lt n \le 10^5)$$$ and $$$k$$$ $$$(0 \lt k \le 10^5, k \le n)$$$ separated by a space. This is followed by $$$k$$$ lines, each describing a request. Each request consists of a single number $$$h_i$$$ $$$(0 \le h_i \lt n)$$$ – the number of the preferred page.
Print $$$k$$$ lines, each containing a single integer $$$r_i$$$ $$$(0 \le r_i \lt n)$$$ – the number of the page allocated in response to the request $$$h_i$$$.
5 3024
0 2 4
5 3222
2 1 3
| Name |
|---|


