5900: 彼佳和楼梯

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:3 通过:3

题目描述


小男孩彼佳非常喜欢楼梯。但他厌倦了简单的上下楼梯——他喜欢一次跳过几个楼梯。当他站在某个楼梯上时,他可以跳到下一个楼梯,也可以一次跳过一两个楼梯。但是有些楼梯太脏了,Petya不想踩到它们。
现在Petya在楼梯的第一个楼梯上,由n个楼梯组成。他也知道这个楼梯的脏楼梯的编号。帮助Petya找出他是否可以跳过整个楼梯并到达最后一个楼梯编号n,而不会碰到肮脏的楼梯一次。
必须注意的是,无论如何,Petya应该踩在第一个和最后一个楼梯上,所以如果第一个或最后一个楼梯很脏,那么Petya不能选择只有干净台阶的路径。

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≤109, 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 d1,d2,...,dm (1≤din) − 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".
Examples
Input
10 5
2 4 8 3 6
Output
NO
Input
10 5
2 4 5 7 9
Output
YES

输入格式

第一行包含两个整数 n 和 m (1≤n≤109, 0≤m≤3000) - 楼梯中的楼梯数和脏楼梯的数量,分别。第二行包含 m 个不同的空格分隔整数 d1,d2,...,dm (1≤di≤n) - 脏楼梯的编号(按任意顺序)。

输出格式

如果Petya可以到达n号楼梯,请打印“是”,只踩在干净的楼梯上。否则打印“否”。
例子
输入
10 5
2 4 8 3 6
输出
NO
输入
10 5
2 4 5 7 9
输出
YES

输入样例 复制

10 5
2 4 8 3 6

输出样例 复制

NO