Submarines

Time limit3sMemory limit128 MB

Problem

A fleet of N submarines is cruising in a single row, all moving in the same direction at the same constant speed. The horizontal distance between any two consecutive submarines is exactly 5 km. Positions are numbered from 1 to N along the direction of movement: the submarine at position 1 is at the front of the fleet and the one at position N is at the back.

Each submarine travels at a distinct depth below the surface, given as an integer number of millimeters. Any submarine may broadcast a signal. A broadcast from a given submarine is received by exactly one other submarine: the closest one that is both behind the sender (at a higher position number) and deeper than the sender. If no such submarine exists, the signal is received by no one.

The submarines are treated as points (their size is ignored), and "closest" means the smallest Euclidean distance. Because the 5 km horizontal spacing between consecutive submarines is larger than the entire depth range, the receiver is always the nearest submarine behind the sender that is deeper than it.

The admiral can issue two kinds of commands:

  • swap positions — given an index i (1 ≤ i < N), the submarine at position i swaps places with the submarine at position i+1. The swap takes no time; each submarine keeps its own depth, and the 5 km horizontal spacing is preserved.
  • send signal — every submarine simultaneously broadcasts a signal, received as described above.

After each send signal command, report the maximum number of signals received by any single submarine.

Input

The first line contains two positive integers N and M separated by a space: N is the number of submarines and M is the number of commands.

The second line contains N positive integers: the depths of the submarines from position 1 to position N.

Each of the next M lines contains one integer. A value i > 0 is a "swap positions" command that swaps the submarines at positions i and i+1; a value 0 is a "send signal" command.

Output

For every "send signal" command, print one line containing a single integer: the maximum number of signals received by any single submarine at that moment.

Constraints

1 mm ≤ depth of each submarine ≤ 3 000 000 mm (3 km).

All depths are distinct.