#P1250A. Berstagram

Berstagram

No submission language available for this problem.

Description

Polycarp recently signed up to a new social network Berstagram. He immediately published nn posts there. He assigned numbers from 11 to nn to all posts and published them one by one. So, just after publishing Polycarp's news feed contained posts from 11 to nn — the highest post had number 11, the next one had number 22, ..., the lowest post had number nn.

After that he wrote down all likes from his friends. Likes were coming consecutively from the 11-st one till the mm-th one. You are given a sequence a1,a2,,ama_1, a_2, \dots, a_m (1ajn1 \le a_j \le n), where aja_j is the post that received the jj-th like.

News feed in Berstagram works in the following manner. Let's assume the jj-th like was given to post aja_j. If this post is not the highest (first) one then it changes its position with the one above. If aja_j is the highest post nothing changes.

For example, if n=3n=3, m=5m=5 and a=[3,2,1,3,3]a=[3,2,1,3,3], then Polycarp's news feed had the following states:

  • before the first like: [1,2,3][1, 2, 3];
  • after the first like: [1,3,2][1, 3, 2];
  • after the second like: [1,2,3][1, 2, 3];
  • after the third like: [1,2,3][1, 2, 3];
  • after the fourth like: [1,3,2][1, 3, 2];
  • after the fifth like: [3,1,2][3, 1, 2].

Polycarp wants to know the highest (minimum) and the lowest (maximum) positions for each post. Polycarp considers all moments of time, including the moment "before all likes".

The first line contains two integer numbers nn and mm (1n1051 \le n \le 10^5, 1m41051 \le m \le 4 \cdot10^5) — number of posts and number of likes.

The second line contains integers a1,a2,,ama_1, a_2, \dots, a_m (1ajn1 \le a_j \le n), where aja_j is the post that received the jj-th like.

Print nn pairs of integer numbers. The ii-th line should contain the highest (minimum) and the lowest (maximum) positions of the ii-th post. You should take into account positions at all moments of time: before all likes, after each like and after all likes. Positions are numbered from 11 (highest) to nn (lowest).

Input

The first line contains two integer numbers nn and mm (1n1051 \le n \le 10^5, 1m41051 \le m \le 4 \cdot10^5) — number of posts and number of likes.

The second line contains integers a1,a2,,ama_1, a_2, \dots, a_m (1ajn1 \le a_j \le n), where aja_j is the post that received the jj-th like.

Output

Print nn pairs of integer numbers. The ii-th line should contain the highest (minimum) and the lowest (maximum) positions of the ii-th post. You should take into account positions at all moments of time: before all likes, after each like and after all likes. Positions are numbered from 11 (highest) to nn (lowest).

Samples

Sample Input 1

3 5
3 2 1 3 3

Sample Output 1

1 2
2 3
1 3

Sample Input 2

10 6
7 3 5 7 3 6

Sample Output 2

1 2
2 3
1 3
4 7
4 5
6 7
5 7
8 8
9 9
10 10