Codeforces Round 212 (Div. 2)
B
Petya and Staircases
Codeforces
1100
原题
← AC →
翻译中…

Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.

翻译中…

Now Petya is on the first stair of the staircase, consisting of $*n*$ stairs. He also knows the numbers of the dirty stairs of this staircase. Help Petya find out if he can jump through the entire staircase and reach the last stair number $*n*$ without touching a dirty stair once.

翻译中…

One has to note that anyway Petya should step on the first and last stairs, so if the first or the last stair is dirty, then Petya cannot choose a path with clean steps only.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*m*$ ($1 ≤ *n* ≤ 10^{9}$, $0 ≤ *m* ≤ 3000$) — the number of stairs in the staircase and the number of dirty stairs, correspondingly. The second line contains $*m*$ different space-separated integers $*d*_{1}, *d*_{2}, ..., *d*_{*m*}$ ($1 ≤ *d*_{*i*} ≤ *n*$) — the numbers of the dirty stairs (in an arbitrary order).

翻译中…

Output

翻译中…

Print "YES" if Petya can reach stair number $*n*$, stepping only on the clean stairs. Otherwise print "NO".

翻译中…

样例

Input #1
10 5
2 4 8 3 6
Output #1
NO
InputCopy OutputCopy
Input #2
10 5
2 4 5 7 9
Output #2
YES
InputCopy OutputCopy
题目信息
题号
362B
时间限制
1 s
内存限制
256 MB
标签
模拟
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。