Pagini recente » Atasamentele paginii oni_2009_11-12_2 | Cod sursa (job #281156) | Istoria paginii runda/kingofthedead/clasament | Cod sursa (job #892368) | Cod sursa (job #2922284)
#include <bits/stdc++.h>
using namespace std ;
/*
ifstream fin("pinex.in");
ofstream fout("pinex.out");
#define cin fin
#define cout fout
*/
#define N 100004
int n, m, k, ok, a[N];
int main()
{
ios_base::sync_with_stdio(0);
cin >> n >> m;
for(int i = 1 ; i <= m ; i++)
{
cin >> a[i];
}
sort(a+1,a+m+1);
for(int i = 1 ; i < m ; i++)
{
k = 0;
while(a[i]+1 == a[i+1])
{
k++;
i++;
}
if(k != 0)
{
if(k >= 2)
{
ok = 1;
}
i--;
}
}
if(a[m] == n || a[1] == 1)ok = 1;
if(ok == 1)cout << "NO";
else cout << "YES";
return 0;
}