最小值如果是1,那么肯定不能下移,最大值如果是m,那么不能上移,如果首项是1,不能下移,如果首项是m,不能上移
n,m = map(int,input().split())
l = [int(i) for i in input().split()]
if n == 1:
print("Yes")
exit()
min1 = min(l[1:])
max1 = max(l[1:])
if l[0] == 1 and max1 == m or l[0] == m and min1 == 1 or max1 == m and min1 == 1:
print("No")
else:
print("Yes")