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".


-----Examples-----
Input
10 5
2 4 8 3 6

Output
NO
Input
10 5
2 4 5 7 9

Output
YES

Difficulty: EASY
Tags: Sorting

Implementation
Skill types: Sorting

Starter code:

Solutions:
(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit(0)
a = set(map(int, input().split()))
l = 0
for i in a:
	if i + 1 in a and i + 2 in a:
		l += 1
if 1 in a or n in a or l > 0:
	print('NO')
else:
	print('YES')


import sys

def check_stairs(n, stairs):
	if len(stairs) == 0:
		print('YES')
		return
	if stairs[0] == 1 or stairs[-1] == n:
		print('NO')
		return
	for i in range(len(stairs) - 2):
		if stairs[i] + 1 == stairs[i + 1] and stairs[i] + 2 == stairs[i + 2]:
			print('NO')
			return
	print('YES')
nm_list = [int(c) for c in sys.stdin.readline().rstrip().split(' ')]
(n, m) = tuple(nm_list)
stairs = []
if m > 0:
	stairs = [int(c) for c in sys.stdin.readline().rstrip().split(' ')]
	stairs.sort()
check_stairs(n, stairs)


def main():
	from sys import stdin, stdout
	(n, m) = map(int, stdin.readline().split())
	if m:
		dirty = sorted(map(int, stdin.readline().split()))
		if dirty[0] == 1 or dirty[-1] == n:
			stdout.write('NO')
		else:
			flag = True
			for i in range(m - 2):
				if dirty[i + 1] == dirty[i] + 1 and dirty[i + 2] == dirty[i] + 2:
					flag = False
					break
			if flag:
				stdout.write('YES')
			else:
				stdout.write('NO')
	else:
		stdout.write('YES')
main()


def ok(x, y, z):
	if abs(x - y) == 1 and abs(y - z) == 1:
		return False
	else:
		return True
(n, m) = map(int, input().split())
if m == 0:
	(print('YES'), exit())
a = list(map(int, input().split()))
a.sort()
if n == m:
	print('NO')
elif a[0] == 1 or a[m - 1] == n:
	print('NO')
elif m < 3:
	print('YES')
else:
	print('NO') if False in list(map(ok, a[0:m - 2], a[1:m - 1], a[2:m])) else print('YES')


def readln():
	return tuple(map(int, input().split()))
(n, m) = readln()
d = sorted(readln()) if m else []
if m and (d[0] == 1 or d[-1] == n) or (m > 2 and [1 for (i, j, k) in zip(d[:-2], d[1:-1], d[2:]) if i + 2 == k]):
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	s = list(map(int, input().split()))
	s.sort()
	if s[0] == 1 or s[-1] == n:
		print('NO')
	else:
		h = 1
		for i in range(m - 2):
			if s[i + 2] == s[i] + 2:
				print('NO')
				h = 0
				break
		if h:
			print('YES')


(n, m) = map(int, input().split())
if m != 0:
	k = list(map(int, input().split()))
	k.sort()
	if k[0] == 1 or k[-1] == n:
		print('NO')
	else:
		for i in range(m - 2):
			if k[i + 1] - k[i] == 1 and k[i + 2] - k[i + 1] == 1:
				print('NO')
				break
		else:
			print('YES')
else:
	print('YES')


def op(d, m):
	if d[0] == 1 or d[m - 1] == n:
		return 1
	if m > 2:
		for i in range(m - 2):
			if d[i + 2] - d[i] == 2:
				return 1
	return 0
(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	d = list(map(int, input().split()))
	d.sort()
	if op(d, m) == 1:
		print('NO')
	else:
		print('YES')


import sys
(n, d) = list(map(int, input().split()))
if d == 0:
	print('YES')
	sys.exit(0)
l = sorted(list(map(int, input().split())))
flag = 0
if l[0] == 1 or l[-1] == n:
	print('NO')
else:
	for i in range(d - 2):
		if l[i + 1] == l[i] + 1 and l[i + 2] == l[i] + 2:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from itertools import combinations, permutations
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(n, k) = r()
if k == 0:
	exit(print('YES'))
arr = rr()
arr.sort()
if 1 in arr or n in arr:
	exit(print('NO'))
for i in range(k - 2):
	if arr[i] + 2 == arr[i + 2]:
		exit(print('NO'))
print('YES')


(a, b) = tuple(input().split(' '))
if b == '0':
	print('YES')
	exit(0)
a = int(a)
b = int(b)
c = [int(x) for x in input().split(' ')]
c.sort()
if 1 in c or a in c:
	print('NO')
	exit(0)
for x in c:
	if x in c and x + 1 in c and (x + 2 in c):
		print('NO')
		exit(0)
print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	arr = list(map(int, input().split()))
	arr.sort()
	if arr[m - 1] == n or arr[0] == 1:
		print('NO')
	else:
		flag = False
		for i in range(0, m - 2):
			if arr[i + 2] - arr[i] == 2:
				print('NO')
				flag = True
				break
		if not flag:
			print('YES')


(n, k) = map(int, input().split())
if k == 0:
	print('YES')
	exit(0)
else:
	l = list(map(int, input().split()))
	l.sort()
	if n in l or 1 in l:
		print('NO')
		exit(0)
	for i in range(k - 2):
		k1 = l[i + 1] - l[i]
		k2 = l[i + 2] - l[i + 1]
		if k1 == k2 == 1:
			print('NO')
			exit(0)
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	quit()
l_d = list(map(int, input().split()))
l_d.sort()
if l_d[0] == 1 or l_d[len(l_d) - 1] == n:
	print('NO')
	quit()
c = 0
p = -1
for d in l_d:
	if d == p + 1:
		c += 1
	else:
		c = 1
	p = d
	if c == 3:
		print('NO')
		quit()
print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
arr = list(map(int, input().split()))
arr.sort()
if 1 in arr or n in arr:
	print('NO')
	exit()
for x in arr:
	if x + 1 in arr and x + 2 in arr:
		print('NO')
		exit()
print('YES')


(n, m) = list(map(int, input().split()))
if m != 0:
	L = list(map(int, input().split()))
else:
	L = []
L.sort()
valid = True
for i in range(2, m):
	if L[i] - L[i - 2] == 2:
		valid = False
if m == 0 or (valid and L[0] != 1 and (L[-1] != n)):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
a = []
if m:
	a += sorted(map(int, input().split()))
print('YNEOS'[any((x in a for x in [1, n])) or any((x + 1 == y == z - 1 for (x, y, z) in zip(a, a[1:], a[2:])))::2])


def main():
	(n, m) = map(int, input().split())
	res = True
	if m:
		l = sorted(map(int, input().split()))
		res = l[0] != 1 and l[-1] != n
		if res and m > 2:
			for (a, b, c) in zip(l, l[1:], l[2:]):
				if b - a == 1 == c - b:
					res = False
					break
	print(('NO', 'YES')[res])

def __starting_point():
	main()
__starting_point()


import sys
import math
(n, m) = [int(x) for x in sys.stdin.readline().split()]
dm = [int(x) for x in sys.stdin.readline().split()]
dm.sort()
if m == 0:
	print('YES')
	exit()
if dm[0] == 1 or dm[m - 1] == n:
	print('NO')
	exit()
val = 0
for i in range(m - 1):
	if math.fabs(dm[i] - dm[i + 1]) == 1:
		val += 1
	else:
		val = 0
	if val > 1:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	c = [int(x) for x in input().split()]
	w = sorted(c)
	if 1 in c or n in c:
		print('NO')
		exit()
	elif m == 1 and (c[0] != 1 or c[0] != n):
		print('YES')
	elif m == 2 and (1 not in c or m not in c):
		print('YES')
	elif 1 in c or n in c:
		print('NO')
		exit()
	elif m == 0:
		print('YES')
	else:
		cn = 0
		for k in range(m - 2):
			if abs(w[k] - w[k + 2]) <= 2:
				print('NO')
				exit()
			else:
				cn = cn + 1
		if cn > 0:
			print('YES')


def mi():
	return map(int, input().split(' '))
(a, b) = mi()
if b == 0:
	print('YES')
	exit()
li = list(mi())
if a in li or 1 in li:
	print('NO')
	exit()
li.sort()
leng = len(li)
for i in range(2, leng):
	if li[i] - li[i - 2] == 2 and li[i] - li[i - 1] == 1:
		print('NO')
		exit()
print('YES')


from sys import stdin, stdout
from collections import Counter
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(last, n) = lst()
	f = 1
	if n:
		a = sorted(lst())
	if n >= 1 and a[0] == 1 or (n >= 1 and a[-1] == last):
		print('NO')
		continue
	cnt = 1
	for i in range(1, n):
		if a[i] == a[i - 1] + 1:
			cnt += 1
		else:
			cnt = 1
		if cnt >= 3:
			f = 0
			break
	print('YES' if f else 'NO')


def mi():
	return map(int, input().split())
(n, m) = mi()
if m == 0:
	print('YES')
	exit(0)
a = list(mi())
if n in a or 1 in a:
	print('NO')
elif m <= 2:
	print('YES')
else:
	a.sort()
	for i in range(1, m - 1):
		if a[i - 1] == a[i] - 1 and a[i + 1] == a[i] + 1:
			print('NO')
			exit(0)
	print('YES')


I = lambda : map(int, input().split())
(n, m) = I()
if m == 0:
	print('YES')
else:
	a = sorted(I())
	t = 1 in a or n in a
	for i in range(1, len(a) - 1):
		if a[i] - a[i - 1] == 1 and a[i + 1] - a[i] == 1:
			t = 1
			break
	print('YNEOS'[t::2])


(n, m) = map(int, input().split())
if m > 0:
	d = list(map(int, input().split()))
	ans = 'YES'
	if 1 in d or n in d:
		ans = 'NO'
	else:
		d.sort()
		i = 1
		while i < m:
			k = 0
			while i < m and d[i] - d[i - 1] == 1:
				k += 1
				i += 1
			if k > 1:
				ans = 'NO'
				break
			i += 1
	print(ans)
else:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
a = list(map(int, input().split()))

def cal(a, m, n):
	if 1 in a or n in a:
		return 'NO'
	a.sort()
	i = 0
	j = 1
	c = 0
	while j < m:
		if a[j] == a[j - 1] + 1:
			c += 1
		else:
			c = 0
		j += 1
		if c == 2:
			return 'NO'
	return 'YES'
print(cal(a, m, n))


(a, b) = tuple(map(int, input().split()))
l = []
if b == 0:
	print('YES')
else:
	l = list(map(int, input().split()))
	l.sort()
	if a in l or 1 in l:
		print('NO')
	else:
		r = [(l[i] - l[i - 1], l[i + 1] - l[i]) for i in range(len(l[1:]))]
		if (1, 1) in r:
			print('NO')
		else:
			print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
d = list(map(int, input().split()))
d.sort()
if d[0] == 1 or d[-1] == n:
	print('NO')
	exit()
for i in range(len(d) - 2):
	if d[i + 1] == d[i] + 1 and d[i + 1] == d[i + 2] - 1:
		print('NO')
		exit()
else:
	print('YES')


(n, m) = map(int, input().split())
if m != 0:
	a = list(map(int, input().split()))
else:
	a = []
a.sort()
cnt = 1
flag = 0
for i in range(m - 1):
	if a[i] + 1 == a[i + 1]:
		cnt += 1
	else:
		cnt = 1
	if cnt > 2:
		flag = 1
if flag == 1 or (m != 0 and (a[0] == 1 or a[m - 1] == n)):
	print('NO')
else:
	print('YES')


R = lambda : map(int, input().split())
(n, m) = R()
d = sorted(R()) if m > 0 else []
print('YES' if len(d) == 0 or (d[0] != 1 and d[m - 1] != n and all((d[i + 2] - d[i] > 2 for i in range(m - 2)))) else 'NO')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit(0)
a = list(map(int, input().strip().split()))
if 1 in a or n in a:
	print('NO')
elif m == 0:
	print('YES')
else:
	a.sort()
	c = 1
	f = 1
	for i in range(m - 1):
		if a[i + 1] - a[i] == 1:
			c += 1
			if c > 2:
				f = 0
				break
		else:
			c = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
try:
	l = sorted(list(map(int, input().split())))
	if l[0] == 1 or l[-1] == n:
		print('NO')
	else:
		ans = 1
		flag = 0
		for i in range(m - 1):
			if l[i] + 1 == l[i + 1]:
				ans += 1
			else:
				ans = 1
			if ans > 2:
				flag = 1
				break
		if flag:
			print('NO')
		else:
			print('YES')
except:
	print('YES')


def main(n, m, a):
	if a[0] == 1 or a[-1] == n:
		return 'NO'
	for i in range(m - 2):
		if a[i] == a[i + 1] - 1 and a[i + 1] == a[i + 2] - 1:
			return 'NO'
	return 'YES'
(n, m) = map(int, input().split(' '))
if m == 0:
	print('YES')
else:
	print(main(n, m, sorted(list(map(int, input().split(' '))))))


(n, m) = list(map(int, input().split()))
if m == 0:
	print('YES')
	exit()
a = list(map(int, input().rstrip().split()))
a.sort()
j = a[0]
if 1 in a or n in a:
	print('NO')
else:
	flag = 0
	for i in range(m - 2):
		if a[i + 1] - a[i] == 1 and a[i + 2] - a[i + 1] == 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def bin(arr, n):
	l = 0
	r = len(arr) - 1
	while l <= r:
		m = (l + r) // 2
		if arr[m] == n:
			return True
		elif arr[m] < n:
			l = m + 1
		else:
			r = m - 1
	return False
(n, m) = [int(i) for i in input().strip().split()]
if m == 0:
	print('YES')
else:
	arr = [int(i) for i in input().strip().split()]
	arr.sort()
	if arr[0] == 1 or arr[-1] == n:
		print('NO')
	else:
		b = True
		for i in arr:
			if bin(arr, i + 1) and bin(arr, i + 2):
				print('NO')
				b = False
				break
		if b:
			print('YES')


n = tuple(map(int, input().split()))
if n[1]:
	a = list(map(int, input().split()))
	a.sort()
c = True
if n[1] == 0:
	print('YES')
	c = False
elif a[0] == 1 or a[-1] == n[0]:
	print('NO')
	c = False
else:
	for i in range(n[1] - 2):
		if a[i] == a[i + 1] - 1 and a[i + 1] == a[i + 2] - 1:
			print('NO')
			c = False
			break
if c:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	x = [int(x) for x in input().split()]
	x = sorted(x)
	f = 0
	if x[0] == 1 or x[len(x) - 1] == n:
		print('NO')
	else:
		for i in range(0, len(x) - 2):
			if x[i + 1] == x[i] + 1 and x[i + 2] == x[i] + 2:
				f = 1
				print('NO')
				break
		if f == 0:
			print('YES')


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
(n, m) = ei()
if m == 0:
	exit(print('YES'))
dirty = ai()
dirty.sort()
check = 0
if 1 in dirty or n in dirty:
	exit(print('NO'))
for i in range(m - 1):
	if abs(dirty[i] - dirty[i + 1]) == 1:
		check += 1
	else:
		check = 0
	if check == 2:
		break
if check == 2:
	print('NO')
else:
	print('YES')


def areConsec(a, b, c):
	if a + 1 == b and b + 1 == c:
		return True
	return False
(n, m) = map(int, input().split())
ans = 'YES'
if m != 0:
	dirts = list(map(int, input().split()))
	dirts.sort()
	for i in range(m):
		if dirts[i] == 1:
			ans = 'NO'
			break
		if dirts[i] == n:
			ans = 'NO'
			break
		if i <= m - 3:
			if areConsec(dirts[i], dirts[i + 1], dirts[i + 2]):
				ans = 'NO'
				break
print(ans)


(n, m) = map(int, input().split())
if m != 0:
	arr = sorted([int(x) for x in input().split()])
else:
	print('YES')
	exit()
if m >= n or arr[0] == 1 or arr[-1] == n:
	print('NO')
else:
	c = 0
	for i in range(m - 1):
		if arr[i + 1] - arr[i] == 1:
			c += 1
		else:
			c = 0
		if c == 2:
			print('NO')
			break
	else:
		print('YES')


def canJump(numStairs, dirty):
	maxJump = 2
	counter = 0
	dirty.sort()
	if dirty[0] == 1 or dirty[-1] == numStairs:
		return False
	for i in range(1, len(dirty)):
		if dirty[i - 1] + 1 == dirty[i]:
			counter += 1
			if counter >= maxJump:
				break
		else:
			counter = 0
	else:
		return True
	return False
s1 = input()
if int(s1.split(' ')[1]) == 0:
	print('YES')
else:
	s2 = input()
	if canJump(int(s1.split(' ')[0]), [int(s) for s in s2.split(' ')]):
		print('YES')
	else:
		print('NO')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
(n, k) = value()
a = sorted(array())
if k == 0:
	print('YES')
	exit()
if a[0] == 1 or a[-1] == n:
	print('NO')
	exit()
for i in range(2, k):
	if a[i] - a[i - 1] == 1 and a[i - 1] - a[i - 2] == 1:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
if m != 0:
	a = [int(x) for x in input().split()]
	a.sort()
	an = 0
	if 1 in a or n in a:
		an = -1
	for i in range(m - 2):
		if a[i + 1] == a[i] + 1 and a[i + 2] == a[i] + 2:
			an = -1
			break
	if an == 0:
		print('YES')
	else:
		print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
l = []
if m > 0:
	l = list(map(int, input().split()))
	l.sort()
if m > 0 and (l[0] == 1 or l[-1] == n):
	print('NO')
	exit()
i = 0
if m >= 3:
	while i < m:
		if i < m - 2 and l[i + 1] - l[i] == 1 and (l[i + 2] - l[i + 1] == 1):
			print('NO')
			exit()
		i += 1
print('YES')


class CodeforcesTask362BSolution:

	def __init__(self):
		self.result = ''
		self.n_m = []
		self.dirty = []

	def read_input(self):
		self.n_m = [int(x) for x in input().split(' ')]
		if self.n_m[1]:
			self.dirty = [int(x) for x in input().split(' ')]

	def process_task(self):
		dirty = {}
		for d in self.dirty:
			dirty[d] = True
		can_ = True
		for d in self.dirty:
			if d - 1 in dirty and d + 1 in dirty:
				can_ = False
				break
		if 1 in dirty or self.n_m[0] in dirty:
			can_ = False
		self.result = 'YES' if can_ else 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask362BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	d = sorted(list(map(int, input().split())))
	for i in range(m - 2):
		if d[i + 1] - d[i] == 1 and d[i + 2] - d[i + 1] == 1:
			print('NO')
			break
	else:
		if d[0] != 1 and d[-1] != n:
			print('YES')
		else:
			print('NO')


(n, m) = input().split()
n = int(n)
m = int(m)
if m == 0:
	print('YES')
else:
	d = input().split()
	d.sort()
	(prev, prev2) = (-5, -5)
	ans = 1
	for i in range(0, m):
		d[i] = int(d[i])
		if d[i] == 1 or d[i] == n:
			ans = 0
		elif d[i] == prev + 1 and d[i] == prev2 + 2:
			ans = 0
		prev2 = prev
		prev = d[i]
	if ans == 0:
		print('NO')
	else:
		print('YES')


size = list(map(int, input().split()))
if size[1] > 0:
	dirty = list(map(int, input().split()))
else:
	dirty = [0]
dirty.sort()
can_go = True
if 1 == dirty[0] or size[0] == dirty[-1]:
	can_go = False
else:
	for i in range(size[1] - 2):
		if dirty[i + 2] - dirty[i + 1] == dirty[i + 1] - dirty[i] == 1:
			can_go = False
			break
		else:
			pass
if can_go:
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
a = sorted(list(map(int, input().split())))
if a[0] == 1 or a[-1] == n:
	print('NO')
	exit()
x = 0
for i in range(m - 1):
	if a[i] + 1 == a[i + 1]:
		x += 1
		if x == 2:
			print('NO')
			exit()
	else:
		x = 0
print('YES')


def ras(n, a):
	i = 0
	a = sorted(a)
	if a[0] == 1 or a[len(a) - 1] == n:
		return 'NO'
	while i < len(a) - 2:
		if a[i + 1] == a[i] + 1 and a[i + 2] == a[i] + 2:
			return 'NO'
		else:
			i = i + 1
	return 'YES'
(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	a = [int(x) for x in input().split()]
	r = ras(n, a)
	print(r)


(n, m) = list(map(int, input().split()))
if m == 0:
	print('YES')
else:
	s = list(map(int, input().split()))
	s = sorted(s)
	(m, c, y) = (0, 1, 'YES')
	if 1 in s or n in s:
		y = 'NO'
	else:
		try:
			for i in s:
				if s[c] - int(i) == 1:
					m += 1
				else:
					m = 0
				if m > 1:
					y = 'NO'
				c += 1
		except:
			pass
	print(y)


(n, k) = map(int, input().split())
if k > 0:
	d = list(map(int, input().split()))
	d.sort()
	f = 1
	if 1 in d:
		print('NO')
	elif n in d:
		print('NO')
	else:
		j = 0
		while j < k - 2:
			if d[j] + 1 == d[j + 1] and d[j + 1] + 1 == d[j + 2]:
				print('NO')
				f = 0
				break
			j += 1
		if f == 1:
			print('YES')
else:
	print('YES')


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)
from collections import deque, Counter, OrderedDict, defaultdict

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
if m == 0:
	print('YES')
	exit()
Arr = get_array()
Arr.sort()
if Arr[0] == 1 or Arr[-1] == n:
	print('NO')
	exit()
flag = 0
for i in range(len(Arr) - 2):
	if Arr[i + 1] == Arr[i] + 1 and Arr[i + 2] == Arr[i] + 2:
		flag = 1
		break
if flag == 0:
	print('YES')
else:
	print('NO')


import sys
(n, m) = tuple((int(x) for x in input().split(' ') if len(x) > 0))
if m == 0:
	print('YES')
	return
d = [int(x) for x in input().split(' ') if len(x) > 0]
d.sort()

def solve():
	if d[0] == 1:
		return 'NO'
	if d[-1] == n:
		return 'NO'
	lc = 0
	for x in range(m - 1):
		i = d[x]
		j = d[x + 1]
		if i == j - 1:
			lc += 1
			if lc > 1:
				return 'NO'
		else:
			lc = 0
	return 'YES'
print(solve())


from sys import stdin, stdout

def solve(n, d, dirty):
	if d == 0:
		return 'YES'
	dirty.sort()
	if dirty[0] == 1 or dirty[d - 1] == n:
		return 'NO'
	max_steps = 1
	for i in range(len(dirty) - 1):
		if dirty[i] + 1 == dirty[i + 1]:
			max_steps += 1
			if max_steps > 2:
				return 'NO'
		else:
			max_steps = 1
	return 'YES'
(n, d) = list(map(int, stdin.readline().rstrip().split()))
count = n
if d != 0:
	dirty = list(map(int, stdin.readline().rstrip().split()))
else:
	dirty = []
stdout.write(str(solve(n, d, dirty)))


(n, k) = map(int, input().split())
if k == 0:
	print('YES')
else:
	d = list(map(int, input().split()))
	d.sort()
	if d[0] == 1 or d[k - 1] == n:
		print('NO')
	else:
		l = 1
		f = 1
		for i in range(1, k):
			if d[i] - d[i - 1] == 1:
				l += 1
			else:
				l = 1
			if l == 3:
				f = 0
				print('NO')
				break
		if f:
			print('YES')


def solve(n, arr):
	arr.sort()
	if arr[0] == 1 or arr[-1] == n:
		return 'NO'
	count = 0
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] == 1:
			count += 1
		else:
			count = 0
		if count == 2:
			return 'NO'
	return 'YES'
(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
res = solve(n, list(map(int, input().split())))
print(res)


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
d = [int(x) for x in input().split()]
d.sort()
if d[0] == 1 or d[-1] == n:
	print('NO')
	exit()
count = 0
for i in range(1, m):
	if d[i - 1] + 1 == d[i]:
		count += 1
	else:
		count = 0
		continue
	if count == 2:
		print('NO')
		exit()
print('YES')


def arr_inp():
	return [int(x) for x in stdin.readline().split()]

def inp():
	return map(int, stdin.readline().split())
from sys import *
(n, m) = inp()
a = sorted(arr_inp())
if m == 0:
	exit(print('YES'))
if a[0] == 1 or a[-1] == n:
	exit(print('NO'))
(pre, move) = (a[0], 0)
for i in a[1:]:
	if i - pre == 1:
		if move >= 1:
			exit(print('NO'))
		else:
			move += 1
	else:
		move = 0
	pre = i
print('YES')


(n, m) = map(int, input().rstrip().split())
if m == 0:
	print('YES')
	exit()
l = list(map(int, input().rstrip().split()))
l.sort()
if l[0] == 1 or l[-1] == n:
	print('NO')
	exit()
for i in range(m - 2):
	if l[i] == l[i + 1] - 1 == l[i + 2] - 2:
		print('NO')
		exit()
print('YES')


(n, m) = map(int, input().split())
s = sorted(list(map(int, input().split()))) if m != 0 else []
if 1 in s or n in s:
	print('NO')
	exit()
if m < 3:
	print('YES')
	exit()
for i in range(m - 2):
	if s[i + 2] - s[i + 1] == s[i + 1] - s[i] == 1:
		print('NO')
		exit()
print('YES')


import sys
import math
import collections
import heapq
input = sys.stdin.readline
(n, m) = (int(i) for i in input().split())
l = sorted([int(i) for i in input().split()])
c = 1
if 1 in l or n in l:
	print('NO')
elif m < 3:
	print('YES')
else:
	for i in range(m - 2):
		if l[i] + 1 == l[i + 1] and l[i] + 2 == l[i + 2]:
			c = 0
			break
	if c == 1:
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
l = []
if m == 0:
	print('YES')
else:
	l = list(map(int, input().split()))
	l.sort()
	cons = 0
	flag = 0
	for i in range(1, m):
		if l[i] - l[i - 1] == 1:
			cons += 1
		else:
			cons = 0
		if cons > 1:
			flag = 1
			break
	if 1 in l or n in l:
		flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


line = input().split()
(n, m) = (int(line[0]), int(line[1]))
flag = 0
if m > 0:
	line = input().split()
if m == 0:
	print('YES')
	flag = 1
else:
	arr = []
	for i in range(m):
		arr.append(int(line[i]))
		if arr[i] == 1 or arr[i] == n:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		arr.sort()
		consi = 1
		for i in range(1, m):
			if arr[i] - arr[i - 1] == 1:
				consi += 1
			else:
				consi = 1
			if consi == 3:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')


(a, b) = [int(i) for i in input().split()]
if b != 0:
	s = [int(i) for i in input().split()]
	s.sort()
if b == 0:
	print('YES')
elif s[0] == 1 or s[-1] == a:
	print('NO')
else:
	x = s[0]
	c = 0
	for i in range(1, len(s)):
		if s[i] == x + 1:
			c += 1
			if c == 2:
				break
		else:
			c = 0
		x = s[i]
	if c == 2:
		print('NO')
	else:
		print('YES')


from sys import *
from math import *
from sys import stdin, stdout
from collections import *
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
(n, m) = get_int()
arr = int_arr()
arr.sort()
if 1 in arr or n in arr:
	print('NO')
elif m == 0:
	print('YES')
else:
	prev = arr[0]
	flag = 1
	ct = 1
	for i in range(1, m):
		if arr[i] == prev + 1:
			prev = arr[i]
			ct += 1
			if ct == 3:
				flag = 0
				print('NO')
				break
		else:
			ct = 1
			prev = arr[i]
	if flag:
		print('YES')


L = input().split()
p = 'YES'
n = int(L[0])
m = int(L[1])
if m > 0:
	T = input().split()
	T.sort()
	if '1' in T or str(n) in T:
		p = 'NO'
	elif m > 2:
		if m == 3:
			if int(T[0]) == int(T[1]) - 1 and int(T[1]) == int(T[2]) - 1:
				p = 'NO'
		else:
			for k in range(len(T) - 2):
				if int(T[k]) == int(T[k + 1]) - 1 and int(T[k + 1]) == int(T[k + 2]) - 1:
					p = 'NO'
					break
print(p)


(n, m) = map(int, input().split())
if m != 0:
	d = [int(x) for x in input().split()]
	d.sort()
	new = []
	for i in range(1, m):
		new.append(d[i] - d[i - 1] - 1)
	count = 0
	maxi = 0
	if d[m - 1] == n or d[0] == 1:
		print('NO')
	else:
		for i in range(m - 1):
			if new[i] == 0:
				count += 1
			else:
				maxi = max(maxi, count)
				count = 0
		maxi = max(maxi, count)
		if maxi > 1:
			print('NO')
		else:
			print('YES')
else:
	print('YES')


(a, b) = map(int, input().split())
if b > 0:
	l = list(map(int, input().split()))
	l.sort()
	if l[0] == 1 or l[-1] == a:
		print('NO')
		exit(0)
	for i in range(b - 2):
		if l[i] + 1 == l[i + 1] and l[i + 1] + 1 == l[i + 2]:
			print('NO')
			exit(0)
	print('YES')
else:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	a = sorted(list(map(int, input().split())))
	if a[0] == 1 or a[-1] == n:
		print('NO')
	else:
		(last, s, ans) = (None, 0, 'YES')
		for i in a:
			if last is None:
				last = i
			elif last + 1 == i:
				s += 1
			else:
				s = 0
			if s == 2:
				ans = 'NO'
				break
			last = i
		print(ans)


def main():
	(n, m) = [int(i) for i in input().split()]
	if m == 0:
		return 'YES'
	d = [int(i) for i in input().split()]
	d = sorted(d)
	status = True
	if 1 in d or n in d:
		return 'NO'
	else:
		for i in range(2, len(d)):
			if d[i] - d[i - 2] == 2:
				return 'NO'
	if status:
		return 'YES'
	else:
		return 'NO'
print(main())


(n, m) = [int(i) for i in input().split()]
if not m:
	print('YES')
	exit()
d = [int(i) for i in input().split()]
if n in d or 1 in d:
	print('NO')
	exit()
d.sort()
i = 0
while i < m - 2:
	if d[i + 2] - d[i + 1] == 1 and d[i + 1] - d[i] == 1:
		print('NO')
		break
	else:
		i += 1
else:
	print('YES')


(n, m) = list(map(int, input().split()))
if m > 0:
	num = [int(x) for x in input().split()]
	num.sort()
ret = True
if m > 0:
	if num[0] == 1 or num[m - 1] == n:
		ret = False
if m > 2:
	for i in range(m - 2):
		if num[i] + 2 == num[i + 1] + 1 == num[i + 2]:
			ret = False
print('YES' if ret else 'NO')


import sys
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
sys.setrecursionlimit(10 ** 7)
mod = 1000000007

def main():
	(n, m) = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	a.sort()
	if m == 0:
		print('YES')
	elif a[-1] == n or a[0] == 1:
		print('NO')
	else:
		flag = True
		for i in range(m - 2):
			if a[i + 2] - a[i] == 2:
				flag = False
				break
		print('YES' if flag else 'NO')
main()


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit(0)
arr = [int(i) for i in input().split()]
arr.sort()
i = 0
if n in arr or 1 in arr:
	print('NO')
	exit(0)
while i < len(arr) - 2:
	if arr[i + 2] - arr[i] == 2:
		print('NO')
		exit(0)
	i += 1
print('YES')


(n, k) = map(int, input().split())
if k == 0:
	print('YES')
else:
	a = list(map(int, input().split()))
	c = 0
	a.sort()
	for i in range(k):
		if a[i] == 1 or a[i] == n:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		count = 0
		i = 1
		point = 0
		while count <= 2 and i < k:
			if a[i] - a[i - 1] == 1:
				count = count + 1
				if count == 2:
					point = 1
					break
			else:
				count = 0
			i = i + 1
		if point == 1:
			print('NO')
		else:
			print('YES')


r = lambda : map(int, input().split())
(n, m) = r()
d = sorted(r()) if m > 0 else [0]
print('NO' if d[0] == 1 or d[-1] == n or any((d[i + 2] - d[i] < 3 for i in range(m - 2))) else 'YES')


from sys import *
(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	exit()
l = sorted(map(int, input().split()))
for i in range(m):
	if l[i] - 2 in l and l[i] - 1 in l or (l[i] + 1 in l and l[i] + 2 in l):
		print('NO')
		break
else:
	if l[0] == 1 or l[-1] == n:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, m) = iia()
arr = sorted(iia())
if len(arr) and (arr[0] == 1 or arr[-1] == n):
	print('NO')
else:
	for i in range(1, m):
		if arr[i] - arr[i - 1] == 1:
			if i + 1 < m and arr[i + 1] - arr[i] == 1:
				print('NO')
				break
	else:
		print('YES')


import math
import sys
from collections import *
from bisect import bisect_left, bisect_right

def cint():
	return list(map(int, sys.stdin.readline().strip().split()))

def cstr():
	return list(map(str, input().split(' ')))

def solve():
	(n, k) = cint()
	lst = cint()
	lst.sort()
	if k == 0:
		print('YES')
		return
	if n == k:
		print('NO')
		return
	if lst[0] == 1 or lst[-1] == n:
		print('NO')
		return
	if k >= 2:
		if lst[0] == 1 and lst[1] == 2:
			print('NO')
			return
		elif lst[-1] == n and lst[-2] == n - 1:
			print('NO')
			return
		for i in range(1, k - 1):
			if lst[i - 1] == lst[i] - 1 and lst[i] == lst[i + 1] - 1:
				print('NO')
				return
	print('YES')
t = 1
while t != 0:
	solve()
	t -= 1


q = input().rstrip().split(' ')
if int(q[1]) == 0:
	print('YES')
else:
	p = input().rstrip().split(' ')
	p.sort(key=int)
	if int(p[0]) == 1 or int(p[len(p) - 1]) == int(q[0]):
		print('NO')
	elif len(p) < 3:
		print('YES')
	else:
		U = 1
		for i in range(0, len(p) - 3 + 1):
			if int(p[i]) + 1 == int(p[i + 1]) and int(p[i + 1]) + 1 == int(p[i + 2]):
				U = 0
				break
		if U == 0:
			print('NO')
		else:
			print('YES')


import sys

def check(c, n):
	start = 1
	for i in range(len(c)):
		if c[i] + 1 in c and c[i] + 2 in c:
			return 'NO'
	return 'YES'
(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	sys.exit()
c = list(map(int, input().split()))
c.sort()
if 1 in c or n in c:
	print('NO')
elif n == 1 and m == 0:
	print('YES')
elif n > 1 and m == 0:
	print('NO')
else:
	print(check(c, n))


(n, m) = (int(x) for x in input().split())
if m == 0:
	print('YES')
	exit()
s = set()
for d in (int(x) for x in input().split()):
	s.add(d)
	if d == 1 or d == n:
		print('NO')
		exit()
	elif d - 1 in s and (d - 2 in s or d + 1 in s):
		print('NO')
		exit()
	elif d + 1 in s and d + 2 in s:
		print('NO')
		exit()
print('YES')


a = list(map(int, input().split()))
if a[1] == 0:
	print('YES')
else:
	m = list(map(int, input().split()))
	m.sort()
	(Max, c) = (0, 1)
	if m[0] != 1 and m[-1] != a[0]:
		for i in range(len(m) - 1):
			if m[i] == m[i + 1] - 1:
				c += 1
				if c > Max:
					Max = c
			else:
				c = 1
		if Max < 3:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


(n, m) = map(int, input().split())
if m == 0:
	print('YES', end='')
else:
	l = list(map(int, input().split()))
	l = sorted(l)
	if l[0] == 1 or l[m - 1] == n:
		print('NO', end='')
	else:
		can = True
		for i in range(m - 2):
			if l[i] + 1 == l[i + 1] and l[i + 1] + 1 == l[i + 2]:
				can = False
				break
		print('YES' if can else 'NO', end='')


(n, d) = map(int, input().split())
if d == 0:
	print('YES')
	exit()
dirt = list(map(int, input().split()))
dirt.sort()
if 1 in dirt or n in dirt:
	print('NO')
	exit()
for i in range(d - 2):
	j = i + 2
	if dirt[i] + 1 == dirt[i + 1] and dirt[i + 1] + 1 == dirt[j]:
		print('NO')
		exit()
print('YES')


inStr = input()
n = int(inStr.split()[0])
m = int(inStr.split()[1])
ans = 'YES'
if not m == 0:
	inStr = input()
	dirty = [int(x) for x in inStr.split()]
	sDirty = sorted(dirty)
	if sDirty[0] == 1 or sDirty[-1] == n:
		ans = 'NO'
	else:
		for i in range(len(sDirty) - 2):
			cur = sDirty[i]
			if sDirty[i + 1] == cur + 1 and sDirty[i + 2] == cur + 2:
				ans = 'NO'
				break
print(ans)


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	quit()
L = sorted(map(int, input().split()))
if L[0] == 1 or L[m - 1] == n:
	print('NO')
else:
	a = []
	for i in range(1, m):
		a.append(L[i] - L[i - 1])
	f = 0
	for i in range(1, m - 1):
		if a[i] == 1 and a[i - 1] == 1:
			f = 1
			break
	print('YNEOS'[f::2])


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	stairs = [i for i in map(int, input().split())]
	stairs = sorted(stairs)
	found = True
	if 1 in stairs or n in stairs:
		print('NO')
	else:
		i = 0
		while i < m - 2:
			sum = stairs[i] * 3 + 3
			if stairs[i] + stairs[i + 1] + stairs[i + 2] == sum:
				found = False
				break
			else:
				i += 1
		if found == True:
			print('YES')
		else:
			print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
if k == 0:
	print('YES')
	exit()
a = list(map(int, input().split()))
pos = 0
f = 0
a.sort()
if a[0] == 1:
	print('NO')
	exit()
elif a[-1] == n:
	print('NO')
	exit()
else:
	for i in range(1, len(a) - 1):
		if a[i] - a[i - 1] == 1 and a[i + 1] - a[i] == 1:
			print('NO')
			exit()
	print('YES')


(n, m) = list(map(int, input().split()))
fff = 1
if m == 0:
	print('YES')
	fff = 0
if fff:
	A = list(map(int, input().split()))
	A.sort()
	cur = 0
	flag = 1
	if A[-1] == n:
		print('NO')
		flag = 0
	if 1 in A and flag:
		print('NO')
		flag = 0
	for i in range(m - 1):
		if A[i + 1] - A[i] == 1 and flag:
			cur += 1
			if cur >= 2:
				print('NO')
				flag = 0
				break
		else:
			cur = 0
	if flag:
		print('YES')


(n, m) = map(int, input().split())
if m == 0:
	ok = True
else:
	hole = sorted(map(int, input().split()))
	ok = hole[0] != 1 and hole[-1] != n
	for i in range(2, m):
		if hole[i] == hole[i - 1] + 1 == hole[i - 2] + 2:
			ok = False
			break
print('YES' if ok else 'NO')


from re import split
num = input()
num = split('\\s', num)
if num[1] == '0':
	print('YES')
	exit()
inp = input()
inp = split('\\s', inp)
for k in range(int(num[1])):
	inp[k] = int(inp[k])
inp.sort()
i = 0
temp1 = False
temp2 = False
m = int(num[1])
n = int(num[0])
while i + 1 < m:
	if int(inp[i + 1]) - int(inp[i]) == 1:
		if temp1:
			temp2 = True
			break
		else:
			temp1 = True
	else:
		temp1 = False
	i += 1
if temp2 or inp[0] == 1 or int(inp[m - 1]) == n:
	print('NO')
else:
	print('YES')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
(total, n) = rinput()
if n == 0:
	print('YES')
else:
	A = rlinput()
	A.sort()
	if A[0] == 1 or A[-1] == total:
		print('NO')
	else:
		for i in range(n - 2):
			if A[i + 2] - A[i] == 2:
				print('NO')
				break
		else:
			print('YES')


(n, m) = map(int, input().split())
arr = [-1]
if m != 0:
	arr = list(map(int, input().split()))
	arr.append(-1)
	arr.sort()
count = 1
flag = 0
for i in range(1, m + 1):
	if arr[i] - arr[i - 1] == 1:
		count += 1
	else:
		count = 1
	if count >= 3:
		flag = 1
if m == 0:
	print('YES')
elif flag or arr[-1] == n or arr[1] == 1:
	print('NO')
else:
	print('YES')


(N, M) = list(map(int, input().split()))
if M > 0:
	Dirty = list(sorted(list(map(int, input().split()))))
	Flag = Dirty[0] != 1 and Dirty[-1] != N
	if Flag:
		Last = Dirty[0]
		Amount = 1
		for Num in Dirty:
			if Last + 1 == Num:
				Amount += 1
			else:
				Amount = 1
			Last = Num
			if Amount == 3:
				Flag = False
				break
	if Flag:
		print('YES')
	else:
		print('NO')
else:
	print('YES')


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial, pow, pi
from bisect import bisect_left, bisect_right

def binNumber(n, size=4):
	return bin(n)[2:].zfill(size)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())

def par(a):
	print(' '.join(list(map(str, a))))

def tdl(outerListSize, innerListSize, defaultValue=0):
	return [[defaultValue] * innerListSize for i in range(outerListSize)]

def sts(s):
	s = list(s)
	s.sort()
	return ''.join(s)

def bis(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return [i, True]
	else:
		return [-1, False]

class pair:

	def __init__(self, f, s):
		self.fi = f
		self.se = s

	def __lt__(self, other):
		return (self.fi, self.se) < (other.fi, other.se)
(n, m) = isp()
if m != 0:
	a = iar()
	a.sort()
else:
	print('YES')
	quit()
c = 1
if 1 in a or n in a:
	print('NO')
	quit()
if m == 1 or m == 2:
	print('YES')
	quit()
c = 2
while c < m:
	if a[c] == a[c - 1] + 1 and a[c] == a[c - 2] + 2:
		print('NO')
		quit()
	else:
		c += 1
print('YES')


(n, m) = map(int, input().split())
if m != 0:
	a = list(map(int, input().split()))[:n]
	a.sort()
if m == 0:
	print('YES')
elif a[0] == 1 or a[-1] == n:
	print('NO')
else:
	d = 0
	for i in range(len(a) - 2):
		if a[i + 1] - a[i] != 1 or a[i + 2] - a[i + 1] != 1:
			continue
		else:
			d = 1
			break
	if d == 1:
		print('NO')
	else:
		print('YES')


from __future__ import division, print_function
import math
import os
import sys
from sys import stdin, stdout
from io import BytesIO, IOBase
from collections import deque
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False
import math

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def main():
	(n, m) = map(int, input().split())
	if m == 0:
		print('YES')
	else:
		d = list(map(int, input().split()))
		d = sorted(d)
		if d[len(d) - 1] == n:
			print('NO')
		elif d[0] == 1:
			print('NO')
		else:
			for i in range(m - 2):
				if d[i + 1] - d[i] == 1 and d[i + 2] - d[i + 1] == 1:
					print('NO')
					break
			else:
				print('YES')
main()


(n, m) = map(int, input().split())
if m != 0:
	L = list(map(int, input().split()))
	L.sort()
if m == 0:
	print('YES')
elif m == 1:
	if L[0] == 1 or L[0] == n:
		print('NO')
	else:
		print('YES')
elif 1 in L or n in L:
	print('NO')
else:
	co = True
	for i in range(1, m - 1):
		if L[i] == L[i - 1] + 1 and L[i] == L[i + 1] - 1:
			co = False
			break
	if co:
		print('YES')
	else:
		print('NO')


def main():
	(n, k) = map(int, input().split())
	if k > 0:
		d = sorted(map(int, input().split()))
		if 1 in d or n in d:
			print('NO')
			return
		else:
			for i in range(k - 2):
				if d[i + 2] == d[i] + 2 and d[i + 1] == d[i] + 1:
					print('NO')
					return
	print('YES')
main()


(k, n) = map(int, input().split())
if n == 0:
	print('YES')
	exit()
l = [int(i) for i in input().split()]
from collections import Counter
c = Counter(l)
l.sort()
for i in range(2, n):
	if l[i] == l[i - 1] + 1 and l[i - 1] == l[i - 2] + 1:
		print('NO')
		exit()
if c[k] or c[1]:
	print('NO')
	exit()
print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	l = list(map(int, input().split()))
	f = 1
	i = 1
	l.sort()
	prev = 0
	if 1 in l or n in l:
		f = 0
	if f == 1:
		for i in range(1, m):
			z = l[i] - l[i - 1]
			if z == prev == 1:
				f = 0
				break
			else:
				prev = z
	if f == 1:
		print('YES')
	else:
		print('NO')


def readln():
	return list(map(int, input().split()))
(n, k) = readln()
dirties = []
if k > 0:
	dirties = readln()
dirties = sorted(dirties)
prevprev = -1
prev = -1
ilegal = False
for val in dirties:
	if prevprev == -1:
		prevprev = val
		continue
	if prev == -1:
		prev = val
		continue
	if prevprev == prev - 1 and prev == val - 1:
		ilegal = True
	prevprev = prev
	prev = val
if ilegal or (k > 0 and (dirties[0] == 1 or dirties[-1] == n)):
	print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	quit()
l = list(map(int, input().split()))
l.sort()
if l[0] == 1 or l[-1] == n:
	print('NO')
	quit()
for i in range(m - 2):
	t = l[i]
	if t == l[i + 1] - 1 and t == l[i + 2] - 2:
		print('NO')
		quit()
print('YES')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
(n, m) = [int(n1) for n1 in input().split()]
if m != 0:
	a = [int(n1) for n1 in input().split()]
	a = sorted(a)
	if a[0] == 1 or a[-1] == n:
		print('NO')
	else:
		count = 0
		for i in range(len(a) - 2):
			if a[i + 1] == a[i] + 1:
				if a[i + 2] == a[i] + 2:
					print('NO')
					count = 1
					break
		if count == 0:
			print('YES')
else:
	print('YES')


w = list(map(int, input().split()))
(n, k) = (w[0], w[1])
if k == 0:
	print('YES')
else:
	s = list(map(int, input().split()))
	s.sort()
	if s[0] == 1 or s[-1] == n:
		print('NO')
	else:
		p = -1
		for i in range(len(s) - 2):
			if s[i + 1] - s[i] == 1:
				if s[i + 2] - s[i + 1] == 1:
					print('NO')
					p = 20
					break
		if p != 20:
			print('YES')


(n, m) = list(map(int, input().split()))
if m:
	d = list(map(int, input().split()))
	d.sort()
	if d[0] == 1 or d[-1] == n:
		print('NO')
	else:
		g = 0
		f = 1
		for i in range(1, m):
			if d[i] - d[i - 1] == 1:
				g = g + 1
			else:
				g = 0
			if g >= 2:
				f = 0
				break
		if f:
			print('YES')
		else:
			print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	t = list(map(int, input().split()))
	t.sort()
	if t[0] == 1 or t[-1] == n:
		print('NO')
	else:
		k = s = 0
		for i in t:
			if i == k:
				s += 1
				k += 1
				if s > 1:
					s = -1
					break
			else:
				(k, s) = (i + 1, 0)
		print('YNEOS'[s == -1::2])


z = list(map(int, input().split()))
if z[1] != 0:
	y = list(map(int, input().split()))
	y.sort()
	if y[0] == 1 or y[-1] == z[0]:
		print('NO')
	else:
		y.append(100000)
		y.append(100000)
		status = True
		for i in range(z[1]):
			if y[i + 1] - y[i] == 1 and y[i + 2] - y[i + 1] == 1:
				status = False
				break
		if status:
			print('YES')
		else:
			print('NO')
else:
	print('YES')


(n, n1) = list(map(int, input().split()))
l = list(map(int, input().split()) if n1 else [])
l.sort()
if n1 == 0:
	print('YES')
elif l[0] == 1 or l[-1] == n:
	print('NO')
else:
	for i in range(n1 - 1):
		if l[i - 1] + 1 == l[i] == l[i + 1] - 1:
			print('NO')
			exit(0)
	print('YES')


(n, m) = map(int, input().split())
if m > 0:
	arr = list(map(int, input().split()))
	no = 0
	arr.sort()
if m == 0:
	print('YES')
	quit()
elif m <= 2 and (arr[0] != 1 and arr[-1] != n):
	print('YES')
	quit()
if arr[0] == 1 or arr[-1] == n:
	print('NO')
	quit()
for i in range(2, m):
	if arr[i] - arr[i - 1] == 1 and arr[i - 1] - arr[i - 2] == 1:
		no += 1
		break
if no == 0:
	print('YES')
else:
	print('NO')


from sys import stdin, exit
from collections import defaultdict
(n, m) = map(int, stdin.readline().split())
l = list(map(int, stdin.readline().split()))
l.sort()
if 1 == 1:
	c = 0
	for i in range(m):
		if l[i] == 1 or l[i] == n:
			print('NO')
			exit()
		if l[i] == l[i - 1] + 1 and i > 0:
			c += 1
		else:
			c = 0
		if c + 1 == 3:
			break
	if c + 1 == 3:
		print('NO')
	else:
		print('YES')


g = input()
(n, m) = [int(x) for x in g.split()]
if m == 0:
	print('YES')
else:
	r = input()
	li = []
	if m > 1:
		for x in r.split():
			li.append(int(x) - 1)
	elif m == 1:
		li.append(int(r) - 1)
	li = sorted(li)
	if 0 in li or n - 1 in li:
		print('NO')
	else:
		d = 0
		flag = 0
		l = 0
		if m > 2:
			for i in range(m - 1):
				if li[i + 1] - li[i] == 1:
					l += 1
					if l == 1:
						t = i
					if i == t:
						d += 1
					if i != t:
						d = 1
					t = i + 1
				if d >= 2:
					flag = 1
					print('NO')
					break
			if flag == 0:
				print('YES')
		else:
			print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	a = list(map(int, input().split()))
	a.sort()
	if a[0] == 1 or a[m - 1] == n or n == m:
		print('NO')
	else:
		pos = 1
		for i in range(m - 2):
			if a[i] == a[i + 1] - 1 == a[i + 2] - 2:
				pos = 0
				print('NO')
				break
		if pos:
			print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	lis = list(map(int, input().split()))
	lis.sort()
	if lis[0] == 1 or lis[-1] == n:
		print('NO')
	else:
		flag = 0
		for i in range(m - 2):
			if lis[i + 2] == lis[i] + 2:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')


while True:
	try:

		def soln(n, k, a):
			a.sort()
			if a[0] == 1 or a[-1] == n:
				print('NO')
				return
			else:
				for i in range(2, k, 1):
					if a[i] == a[i - 1] + 1 and a[i - 1] == a[i - 2] + 1:
						print('NO')
						return
				print('YES')

		def read():
			(n, k) = map(int, input().split())
			if k > 0:
				a = list(map(int, input().split()))
			else:
				print('YES')
				return
			soln(n, k, a)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


(n, m) = map(int, input().split())
arr = []
if m == 0:
	print('YES')
	exit()
else:
	arr = list(map(int, input().split()))
arr.sort()
if arr[0] == 1 or arr[m - 1] == n:
	print('NO')
	exit()
st = 0
for i in range(1, m):
	if arr[i] == arr[i - 1] + 1:
		st += 1
	else:
		st = 0
	if st == 2:
		print('NO')
		exit()
print('YES')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
(n, m) = rinput()
d = get_list()
if 1 in d or n in d:
	print('NO')
else:
	d.sort()
	flag = 0
	for i in range(m - 2):
		if d[i + 2] == d[i + 1] + 1 and d[i + 1] == d[i] + 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


def solve(n, m, seq):
	if m > 0:
		seq.sort()
		if seq[0] == 1 or seq[-1] == n:
			return 'NO'
		else:
			index = 1
			consecutive = 1
			while index < m:
				if seq[index] == seq[index - 1] + 1:
					consecutive += 1
				elif consecutive > 2:
					return 'NO'
				else:
					consecutive = 1
				index += 1
			if consecutive > 2:
				return 'NO'
			return 'YES'
	else:
		return 'YES'
(n, m) = list(map(int, input().split()))
seq = []
if m > 0:
	seq.extend(list(map(int, input().split())))
print(solve(n, m, seq))


(n, m) = map(int, input().split())
if m > 0:
	a = [int(x) for x in input().split()]
	a.sort()
	flag = True
	for i in range(m - 2):
		if a[i + 2] == a[i] + 2:
			flag = False
			break
	if flag == False:
		print('NO')
	elif a[0] == 1 or a[m - 1] == n:
		print('NO')
	else:
		print('YES')
else:
	print('YES')


(n, m) = map(int, input().split())
d = None
if m > 0:
	d = list(map(int, input().split()))
	if n in d or 1 in d:
		print('NO')
	elif m <= 2:
		print('YES')
	else:
		d.sort()
		a = []
		found = False
		for i in range(1, m):
			a.append(d[i] - d[i - 1])
		for i in range(1, m - 1):
			if a[i] == 1:
				if a[i - 1] == 1:
					found = True
					break
		if found:
			print('NO')
		else:
			print('YES')
else:
	print('YES')


(n, m) = map(int, input().split())
if m > 0:
	stairs = [int(z) for z in input().split()]
	stairs.sort()
else:
	print('YES')
	exit()
if m < 3 and stairs[-1] != n and (stairs[0] != 1):
	print('YES')
	exit()
if stairs[-1] == n or stairs[0] == 1:
	print('NO')
	exit()
for x in range(m - 2):
	if stairs[x] == stairs[x + 1] - 1:
		if stairs[x + 1] == stairs[x + 2] - 1:
			print('NO')
			exit()
print('YES')


(n, m) = map(int, input().split())
if m != 0:
	arr = list(map(int, input().split()))
	arr.sort()
if m == 0:
	print('YES')
elif m == 1:
	if arr[0] == 1 or arr[0] == n:
		print('NO')
	else:
		print('YES')
elif m == 2:
	if arr[0] == 1 or arr[m - 1] == n:
		print('NO')
	else:
		print('YES')
elif arr[0] == 1 or arr[m - 1] == n:
	print('NO')
else:
	for i in range(m - 2):
		areConsecutive = False
		if arr[i] + 1 == arr[i + 1] and arr[i + 1] + 1 == arr[i + 2]:
			areConsecutive = True
			break
	if areConsecutive == True:
		print('NO')
	else:
		print('YES')


I = lambda : map(int, input().split())
(n, m) = I()
if m:
	D = sorted(I())
	if 1 in D or n in D or any((D[i] == D[i + 1] - 1 == D[i + 2] - 2 for i in range(m - 2))):
		print('NO')
	else:
		print('YES')
else:
	print('YES')


(n, d) = map(int, input().split())
jump = []
if d != 0:
	jump = sorted(list(map(int, input().split())))
if d == 0:
	print('YES')
	exit()
if jump[0] == 1 or jump[len(jump) - 1] == n:
	print('NO')
	exit()
if d == 1 or d == 2:
	print('YES')
	exit()
for i in range(d - 2):
	if jump[i + 1] - jump[i] == 1 and jump[i + 2] - jump[i] == 2:
		print('NO')
		exit()
print('YES')


import sys
(n, m) = map(int, input().split())
if m != 0:
	data = [int(el) for el in input().split()]
	data.sort()
	if data[0] == 1 or data[-1] == n:
		print('NO')
		sys.exit()
	for e in range(m - 2):
		if data[e] + data[e + 1] + data[e + 2] == data[e] * 3 + 3:
			print('NO')
			break
	else:
		print('YES')
else:
	print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
	quit()
d = sorted(map(int, input().split()))
if 1 in d or n in d:
	print('NO')
else:
	for x in range(m - 2):
		if d[x] == d[x + 1] - 1 == d[x + 2] - 2:
			print('NO')
			break
	else:
		print('YES')


n = input().split(' ')
m = int(n[1])
n = int(n[0])
if m != 0:
	stair = input().split(' ')
else:
	print('YES')
	exit(0)
stair = list(map(int, stair))
stair = sorted(stair)
diff = [y - x for (x, y) in zip(stair[:-1], stair[1:])]
if 1 in stair or n in stair:
	print('NO')
	exit(0)
for i in range(0, len(diff) - 1):
	if diff[i] == 1 and diff[i + 1] == 1:
		print('NO')
		exit(0)
print('YES')


(n, d) = list(map(int, input().split()))
ans = 'YES'
if d > 0:
	dirty = list(map(int, input().split()))
	dirty.sort()
	if dirty[0] == 1 or dirty[d - 1] == n:
		ans = 'NO'
	else:
		for i in range(2, d):
			if dirty[i] == dirty[i - 1] + 1 == dirty[i - 2] + 2:
				ans = 'NO'
				break
print(ans)


def main():
	(n, m) = map(int, input().split())
	if m == 0:
		print('YES')
		return
	dirty = sorted(list(map(int, input().split())))
	if dirty[0] == 1 or dirty[-1] == n:
		print('NO')
		return
	cnt = 1
	for i in range(1, m):
		if dirty[i] - dirty[i - 1] == 1:
			cnt += 1
			if cnt > 2:
				print('NO')
				break
		else:
			cnt = 1
	else:
		print('YES')
main()


import sys
(n, m) = list(map(int, input().split()))
if m == 0:
	print('YES')
	sys.exit()
d = sorted(map(int, input().split()))
if d[0] == 1 or d[-1] == n:
	print('NO')
	sys.exit()
for x in range(m - 2):
	if d[x] == d[x + 1] - 1 == d[x + 2] - 2:
		print('NO')
		sys.exit()
print('YES')


strs = list(map(int, input().split(' ')))
n = strs[0]
if strs[1] == 0:
	print('YES')
	exit(0)
dirty = list(map(int, input().split(' ')))
dirty.sort()
if dirty[0] == 1 or dirty[-1] == n:
	print('NO')
else:
	steps = 1
	flag = True
	for i in range(1, len(dirty), 1):
		if dirty[i] - dirty[i - 1] == 1:
			steps += 1
		else:
			steps = 1
		if steps == 3:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


(l, d) = map(int, input().split())
if d:
	x = sorted(list(map(int, input().split())))
if d == 0:
	print('YES')
	quit()
if x[0] == 1 or x[-1] == l:
	print('NO')
	quit()
elif d == 1:
	print('YES')
	quit()
elif d == 2:
	print('YES')
	quit()
else:
	for i in range(2, d):
		if x[i] == x[i - 1] + 1 and x[i] == x[i - 2] + 2:
			print('NO')
			quit()
print('YES')


import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter as c
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(var)

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
(n, m) = sp()
arr = l()
arr.sort()
if 1 in arr or n in arr:
	out('NO')
	exit()
for i in range(len(arr) - 2):
	(a, b) = (arr[i + 2] - arr[i + 1], arr[i + 1] - arr[i])
	if a == 1 and b == 1:
		out('NO')
		exit()
out('YES')


import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans
mod = int(1000000000.0) + 7

def ssinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def nninp():
	return map(int, sys.stdin.readline().strip().split())

def llinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
(n, m) = nninp()
d = llinp()
cnt = 0
if 1 in d or n in d:
	print('NO')
	exit()
else:
	d.sort()
	for i in d:
		if i + 1 in d and i + 2 in d:
			print('NO')
			exit()
	print('YES')
	exit()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.setrecursionlimit(int(pow(10, 6)))
	sys.stdin = open('input.txt', 'r')
except:
	pass
(n, m) = L()
A = sorted(L())
if n in A or 1 in A:
	print('NO')
	exit()
if m < 3:
	print('YES')
	exit()
for i in range(0, m - 2):
	if A[i + 1] == A[i] + 1 and A[i + 2] == A[i] + 2:
		print('NO')
		exit()
print('YES')
endtime = time.time()


def func(dirty_stairs):
	for i in range(m - 2):
		if dirty_stairs[i + 1] - dirty_stairs[i] == 1:
			if dirty_stairs[i + 2] - dirty_stairs[i + 1] == 1:
				return 'NO'
	return 'YES'
(n, m) = map(int, input().split())
if m != 0:
	dirty_stairs = sorted(list(map(int, input().split())))
else:
	print('YES')
if m != 0 and (dirty_stairs[0] == 1 or dirty_stairs[-1] == n):
	print('NO')
elif m != 0:
	if n <= 4:
		print('YES')
	else:
		print(func(dirty_stairs))


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	s = sorted([int(i) for i in input().split()])
	cnt = 0
	a = 0
	for i in range(m - 1):
		if s[i + 1] - s[i] == 1:
			cnt += 1
		else:
			cnt = 0
		a = max(a, cnt + 1)
	if a > 2 or s[-1] == n or s[0] == 1:
		print('NO')
	else:
		print('YES')


(a, b) = [int(i) for i in input().split()]
flag = 0
if b == 0:
	print('YES')
else:
	c = [int(i) for i in input().split()]
	d = sorted(c)
	if 1 in d or a in d:
		flag = 1
	elif len(d) >= 3:
		for i in range(0, len(d) - 2):
			if d[i + 1] - d[i] == 1 and d[i + 2] - d[i + 1] == 1:
				flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


st = input()
st = st.split()
if st[1] != '0':
	d = input()
	d = d.split()
	for i in range(0, len(d)):
		d[i] = int(d[i])
	for i in range(0, len(st)):
		st[i] = int(st[i])
	d.sort()
	if d[0] == 1 or d[len(d) - 1] == st[0]:
		print('NO')
		exit(0)
	for i in range(0, len(d) - 2):
		if int(d[i]) + 1 == int(d[i + 1]) and int(d[i + 1]) + 1 == int(d[i + 2]):
			print('NO')
			exit(0)
	print('YES')
	exit(0)
print('YES')


(n, m) = [int(x) for x in input().split()]
d = []
found = False
if m != 0:
	d = [int(x) for x in input().split()]
	d.sort()
	if d[0] == 1 or d[m - 1] == n:
		print('NO')
		found = True
if not found:
	found = False
	for i in range(2, m):
		if d[i - 2] == d[i] - 2 and d[i - 1] == d[i] - 1:
			found = True
			print('NO')
			break
	if not found:
		print('YES')


def solve(l, n, m):
	l.sort()
	count = 1
	for i in range(1, m):
		if l[i] - l[i - 1] == 1:
			count += 1
		else:
			count = 1
		if count > 2:
			return 'NO'
	return 'YES'
(n, m) = map(int, input().split())
if m > 0:
	l = list(map(int, input().split()))
if m == 0:
	print('YES')
elif 1 in l or n in l:
	print('NO')
else:
	print(solve(l, n, m))


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
(total, n) = rinput()
if n == 0:
	print('YES')
else:
	A = rlinput()
	A.sort()
	if A[0] == 1 or A[-1] == total:
		print('NO')
	else:
		i = 1
		flag = False
		while i < n:
			if A[i] - A[i - 1] == 1:
				i += 1
				count = 1
				while i < n and A[i] - A[i - 1] == 1:
					i += 1
					count += 1
					if count == 2:
						flag = True
						print('NO')
						break
				if flag:
					break
			i += 1
		else:
			print('YES')


(n, m) = map(int, input().split())

def fn(m, n):
	if m == 0:
		return 'YES'
	a = list(map(int, input().split()))
	a.sort()
	if a[-1] == n or a[0] == 1:
		return 'NO'
	jump = 1
	cur = a[0] - 1
	i = 0
	while i < m:
		if cur + jump == a[i]:
			jump += 1
			i += 1
		else:
			jump = 1
			cur = a[i] - 1
		if jump > 3:
			return 'NO'
	return 'YES'
print(fn(m, n))


X = list(map(int, input().split()))
if X[1] == 0:
	print('YES')
	exit()
Stairs = sorted(list(map(int, input().split())))
if 1 in Stairs or X[0] in Stairs:
	print('NO')
	exit()
Check = False
for i in range(1, X[1]):
	if Stairs[i] - Stairs[i - 1] == 1:
		if Check:
			print('NO')
			exit()
		Check = True
	else:
		Check = False
print('YES')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	dirty = list(map(int, input().split()))
	c = True
	if 1 in dirty or n in dirty:
		print('NO')
	else:
		for m in dirty:
			i = m - 1
			if i + 2 in dirty and i + 3 in dirty:
				c = False
		if c:
			print('YES')
		else:
			print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
(n, m) = mi()
if m == 0:
	print('YES')
	exit()
arr = li()
arr.sort()
if n < 3 and m == 1 or arr[0] == 1 or arr[-1] == n:
	print('NO')
else:
	for i in range(1, m - 1):
		if arr[i + 1] - arr[i - 1] == 2:
			print('NO')
			exit()
	else:
		print('YES')


import sys
(n, m) = map(int, input().split())
ans = False
if m > 0:
	a = list(map(int, input().split()))
else:
	print('YES')
	sys.exit()
a.sort()
set(a)
if a[0] == 1 or a[m - 1] == n:
	ans = True
else:
	for i in range(2, m):
		if a[i] == a[i - 1] + 1 and a[i] == a[i - 2] + 2:
			ans = True
if ans:
	print('NO')
else:
	print('YES')


import sys
input = sys.stdin.buffer.readline
(n, m) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
if m == 0:
	print('YES')
elif arr[0] == 1 or arr[-1] == n:
	print('NO')
elif m < 3:
	print('YES')
else:
	flag = True
	for i in range(m - 2):
		if 1 + arr[i] == arr[i + 1] and 1 + arr[i + 1] == arr[i + 2]:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
if m == 0:
	print('YES')
else:
	dirty_stairs = list(map(int, input().split()))
	dirty_stairs.sort()
	identifier = 1
	if dirty_stairs[0] == 1 or dirty_stairs[-1] == n:
		print('NO')
		identifier = 0
	else:
		for x in range(0, m):
			try:
				if dirty_stairs[x] == dirty_stairs[x + 1] - 1 and dirty_stairs[x + 1] == dirty_stairs[x + 2] - 1:
					print('NO')
					identifier = 0
					break
			except IndexError:
				pass
	if identifier == 1:
		print('YES')


(n, k) = map(int, input().split())
if k == 0:
	print('YES')
else:
	l = list(map(int, input().split()))
	l.sort()
	if 1 in l or n in l:
		print('NO')
	else:
		c = 0
		for i in range(1, k):
			if l[i] - l[i - 1] == 1:
				c += 1
			elif c != 0:
				c = 0
			if c == 2:
				break
		if c == 2:
			print('NO')
		else:
			print('YES')