+ محدودیت زمان: ۱ ثانیه
+ محدودیت حافظه: ۲۵۶ مگابایت
---
Majid has a binary string of length $n$ with only 1 values. One morning, his niece accidentally finds this string and starts destroying it. She destroys the string in $t$ steps. The niece first chooses a sequence of integers: $1 \leq a_1 \leq a_2 \leq \dots \leq a_t \leq n$. Then, in the $i$-th step, she selects the first $a_i$ bits and destroys this part as follows:
- First, she negates all the selected bits.
- Then, she reverses the order of the selected part.
To be more precise, if the binary string before the $i$-th step is as follows:
$$S = s_1 s_2, \dots, s_n$$
The binary string after the $i$-th step will be as follows, where $\bar{s}_i$ represents the negation of bit $s_i$:
$$S = \bar{s}_{a_i}, \bar{s}_{a_i-1}, \dots, \bar{s}_1, s_{a_i+1}, \dots, s_n$$
Majid wants to restore the string to its initial state using his superpower. Each time Majid uses his superpower, he chooses two numbers $1 \leq l \leq r \leq n$. Then, magically, all the bits in positions from $l$ to $r$ inclusive are negated. This interval includes the bits at positions $l$ and $r$ themselves. The positions of the bits are considered from left to right, and the leftmost bit has a position of $1$.
Help Majid restore the string to its initial state with the fewest number of uses of his superpower.
# ورودی
The first line of the input consists of two integers $n$ $(1 \leq n \leq 10^{18})$ and $t$ $(1 \leq t \leq 10^5)$ separated by a space, which is the length of the string and the number of steps of string destruction, respectively.
The second line contains a sequence of integers $a_1, a_2, \dots, a_t$ $(1 \leq a_i \leq n)$, chosen by the niece.
# خروجی
Print $k$, the minimum number of times Majid needs to use his superpower in the first line.
Then, in the $(i+1)$th line $(1 \leq i \leq k)$ of the output, print the interval that Majid chooses in his use of superpower as two numbers separated by a space, in ascending order.
## ورودی نمونه 1
```
5 2
2 5
```
## خروجی نمونه 1
```
1
1 3
```
## ورودی نمونه 2
```
5 2
3 3
```
## خروجی نمونه 2
```
0
```
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.