Each of the n cards has numbers written on the both sides of it. The first card has 0 and 1 on it, the second has 1 and 2, …, the n-th has (n − 1) and n. First-grade pupil Nick takes cards one by one in random order and reads the number on one of the sides. Nick is not very good with numbers, so it is possible that he makes a mistake. Your task is to find out if he was mistaken, i.e. if the given sequence of numbers is possible for some order of taking cards.
The first line contains integers n, the total number of cards, and m, the number of the cards that were taken (2 ≤ n ≤ 1000; 1 ≤ m ≤ n).
In the second line m integers are listed (the sequence read by Nick). All these integers are from 0 to n.
Write “YES” if the given sequence of numbers is possible for some order of taking cards, “NO” otherwise.
2 0 1 2
Problem Source: Quarterfinal, Central region of Russia, Rybinsk, October 17-18 2001