//#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <memory.h>
#include <functional>
#include <numeric>

using namespace std;

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i<=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforba(i,b,a) for(__typeof(b) i=(b);i>=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

#define pb push_back
#define sz(a) ((int)a.size())
#define ms(a,n) memset(a, n, sizeof(a))
#define ms0(a) ms(a,0)
#define all(a) a.begin(), a.end()
#define sorts(a) sort(all(a))
#define sorta(a,n) sort(a,a+n)
#define sqr(a) ((a)*(a))
#define amax(a,b) ( (a) = max( (a) , (b) ) )
#define amin(a,b) ( (a) = min( (a) , (b) ) )
#define mp make_pair
#define abs(x) (((x)<0)?-(x):(x))
//#define lb(v,s) std::lower_bound (v.begin(), v.end(), s);
//#define ub(v,s) std::upper_bound (v.begin(), v.end(), s);

#define ff first
#define se second
//#define pi 2*acos(0.0)
#define pi 3.14159265358979
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define popcount(i) __builtin_popcount(i)                         //count one
#define parity(i)   __builtin_parity(i)       //evenparity 0 and odd parity 1
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)

//input
#define sfi(t) scanf("%d",&t)
#define sfii(a,b) scanf("%d %d",&a,&b)
#define sfiii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfll(t) scanf("%lld",&t)
#define sfllll(a,b) scanf("%lld %lld",&a,&b)
#define sfllllll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sfd(t) scanf("%lf",&t)
#define sfc(c) scanf("%c",&c)
#define sfs(s) scanf("%s",s)

//Output
#define pfi(a) printf("%d\n",a)
#define pfii(a,b) printf("%d %d\n",a,b)
#define pfiii(a,b,c) printf("%d %d %d\n",a,b,c)
#define pfll(a) printf("%lld\n",a)
#define pfllll(a,b) printf("%lld %lld\n",a,b)
#define pfllllll(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pfd(a) printf("%lf\n",a)
#define pfs(a) printf("%s\n",a)
#define pfis(a) printf("%d ",a)
#define pflls(a) printf("%lld ",a)
#define pfds(a) printf("%lf ",a)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;
typedef pair<string,int> psi;
typedef vector<pii> vii;
typedef set<int> si;
typedef set<string> ss;
typedef map<int,int> mii;
typedef map<string,int> msi;

//ll big_mod(ll b, ll p,ll Mod){if(p==1) return b;else if() if(p==0) return 1;ll x=pow(b,p/2,Mod);x=(x*x)%Mod;if(b&1) x=(x*a)%Mod;return x;}
//ll modInverse(ll a, ll m){return big_mod(a,m-2,m);}

#define dbg(x) cout<<#x<<'='<<x<<endl;
#define dbgarr(i,a) cout<<#a<<"["<<i<<"] = "<<a[i]<<" "<<endl;
#define maxll 9223372036854775807
#define minll -9223372036854775808
#define maxl 2147483647
#define minl -2147483648
#define mx7 10000007
#define mx6 1000006
#define mx5 100005
#define ret return

//double beg=clock();
//double end=clock();
//    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
////CODE HERE

#define mx 46350
#define mod 1000000007

int main(){
    int n,m;
    while(sfii(n,m)==2){
        int a[3009];
        for(int i=1;i<=m;i++){
            sfi(a[i]);
        }

        sort(a,a+m+1);

        if(a[1]==1 || a[k]==n){
            pfs("NO");
            ret 0;
        }

        bool b=0;
        for(int i=1;i<=m-2;i++){
            if(((a[i+2]-a[i+1])==1) && ((a[i+1]-a[i])==1)){
                b=1;
                break;
            }
        }
        if(b==1){
            pfs("NO");
        }
        else{
            pfs("YES");
        }
    }
    return 0;
}


//#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <memory.h>
#include <functional>
#include <numeric>

using namespace std;

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i<=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforba(i,b,a) for(__typeof(b) i=(b);i>=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

#define pb push_back
#define sz(a) ((int)a.size())
#define ms(a,n) memset(a, n, sizeof(a))
#define ms0(a) ms(a,0)
#define all(a) a.begin(), a.end()
#define sorts(a) sort(all(a))
#define sorta(a,n) sort(a,a+n)
#define sqr(a) ((a)*(a))
#define amax(a,b) ( (a) = max( (a) , (b) ) )
#define amin(a,b) ( (a) = min( (a) , (b) ) )
#define mp make_pair
#define abs(x) (((x)<0)?-(x):(x))
//#define lb(v,s) std::lower_bound (v.begin(), v.end(), s);
//#define ub(v,s) std::upper_bound (v.begin(), v.end(), s);

#define ff first
#define se second
//#define pi 2*acos(0.0)
#define pi 3.14159265358979
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define popcount(i) __builtin_popcount(i)                         //count one
#define parity(i)   __builtin_parity(i)       //evenparity 0 and odd parity 1
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)

//input
#define sfi(t) scanf("%d",&t)
#define sfii(a,b) scanf("%d %d",&a,&b)
#define sfiii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfll(t) scanf("%lld",&t)
#define sfllll(a,b) scanf("%lld %lld",&a,&b)
#define sfllllll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sfd(t) scanf("%lf",&t)
#define sfc(c) scanf("%c",&c)
#define sfs(s) scanf("%s",s)

//Output
#define pfi(a) printf("%d\n",a)
#define pfii(a,b) printf("%d %d\n",a,b)
#define pfiii(a,b,c) printf("%d %d %d\n",a,b,c)
#define pfll(a) printf("%lld\n",a)
#define pfllll(a,b) printf("%lld %lld\n",a,b)
#define pfllllll(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pfd(a) printf("%lf\n",a)
#define pfs(a) printf("%s\n",a)
#define pfis(a) printf("%d ",a)
#define pflls(a) printf("%lld ",a)
#define pfds(a) printf("%lf ",a)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;
typedef pair<string,int> psi;
typedef vector<pii> vii;
typedef set<int> si;
typedef set<string> ss;
typedef map<int,int> mii;
typedef map<string,int> msi;

//ll big_mod(ll b, ll p,ll Mod){if(p==1) return b;else if() if(p==0) return 1;ll x=pow(b,p/2,Mod);x=(x*x)%Mod;if(b&1) x=(x*a)%Mod;return x;}
//ll modInverse(ll a, ll m){return big_mod(a,m-2,m);}

#define dbg(x) cout<<#x<<'='<<x<<endl;
#define dbgarr(i,a) cout<<#a<<"["<<i<<"] = "<<a[i]<<" "<<endl;
#define maxll 9223372036854775807
#define minll -9223372036854775808
#define maxl 2147483647
#define minl -2147483648
#define mx7 10000007
#define mx6 1000006
#define mx5 100005
#define ret return

//double beg=clock();
//double end=clock();
//    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
////CODE HERE

#define mx 46350
#define mod 1000000007

int main(){
    int n,k;
    int a[3009];
    while(sfii(n,k)==2){
        int ai;
        for(int i=0;i<k;i++){
            sfi(a[i]);
        }
        sort(a,a+k);
        bool b=0;
        for(int i=0;i<k-2;i++){
            if( ((a[i+2]-a[i+1])==1) && ((a[i+1]-a[i])==1) ){
                b=1;
                break;
            }
        }
        if(b==1){
            pfs("NO");
        }
        else{
            pfs("YES");
        }
    }
    return 0;
}


//#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <memory.h>
#include <functional>
#include <numeric>

using namespace std;

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i<=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforba(i,b,a) for(__typeof(b) i=(b);i>=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

#define pb push_back
#define sz(a) ((int)a.size())
#define ms(a,n) memset(a, n, sizeof(a))
#define ms0(a) ms(a,0)
#define all(a) a.begin(), a.end()
#define sorts(a) sort(all(a))
#define sorta(a,n) sort(a,a+n)
#define sqr(a) ((a)*(a))
#define amax(a,b) ( (a) = max( (a) , (b) ) )
#define amin(a,b) ( (a) = min( (a) , (b) ) )
#define mp make_pair
#define abs(x) (((x)<0)?-(x):(x))
//#define lb(v,s) std::lower_bound (v.begin(), v.end(), s);
//#define ub(v,s) std::upper_bound (v.begin(), v.end(), s);

#define ff first
#define se second
//#define pi 2*acos(0.0)
#define pi 3.14159265358979
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define popcount(i) __builtin_popcount(i)                         //count one
#define parity(i)   __builtin_parity(i)       //evenparity 0 and odd parity 1
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)

//input
#define sfi(t) scanf("%d",&t)
#define sfii(a,b) scanf("%d %d",&a,&b)
#define sfiii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfll(t) scanf("%lld",&t)
#define sfllll(a,b) scanf("%lld %lld",&a,&b)
#define sfllllll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sfd(t) scanf("%lf",&t)
#define sfc(c) scanf("%c",&c)
#define sfs(s) scanf("%s",s)

//Output
#define pfi(a) printf("%d\n",a)
#define pfii(a,b) printf("%d %d\n",a,b)
#define pfiii(a,b,c) printf("%d %d %d\n",a,b,c)
#define pfll(a) printf("%lld\n",a)
#define pfllll(a,b) printf("%lld %lld\n",a,b)
#define pfllllll(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pfd(a) printf("%lf\n",a)
#define pfs(a) printf("%s\n",a)
#define pfis(a) printf("%d ",a)
#define pflls(a) printf("%lld ",a)
#define pfds(a) printf("%lf ",a)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;
typedef pair<string,int> psi;
typedef vector<pii> vii;
typedef set<int> si;
typedef set<string> ss;
typedef map<int,int> mii;
typedef map<string,int> msi;

//ll big_mod(ll b, ll p,ll Mod){if(p==1) return b;else if() if(p==0) return 1;ll x=pow(b,p/2,Mod);x=(x*x)%Mod;if(b&1) x=(x*a)%Mod;return x;}
//ll modInverse(ll a, ll m){return big_mod(a,m-2,m);}

#define dbg(x) cout<<#x<<'='<<x<<endl;
#define dbgarr(i,a) cout<<#a<<"["<<i<<"] = "<<a[i]<<" "<<endl;
#define maxll 9223372036854775807
#define minll -9223372036854775808
#define maxl 2147483647
#define minl -2147483648
#define mx7 10000007
#define mx6 1000006
#define mx5 100005
#define ret return

//double beg=clock();
//double end=clock();
//    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
////CODE HERE

#define mx 46350
#define mod 1000000007

int main(){
    int n,m;
    while(sfii(n,m)==2){
        int a[3009];
        for(int i=1;i<=m;i++){
            sfi(a[i]);
        }

        sort(a,a+m+1);

        if(a[1]==1 || a[m]==n){
            pfs("NO");
            ret 0;
        }

        bool b=0;
        for(int i=1;i<=m-2;i++){
            if(((a[i+2]-a[i+1])==1) && ((a[i+1]-a[i])==1)){
                b=1;
                break;
            }
        }
        if(b==1){
            pfs("NO");
        }
        else{
            pfs("YES");
        }
    }
    return 0;
}


//#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <memory.h>
#include <functional>
#include <numeric>

using namespace std;

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i<=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforba(i,b,a) for(__typeof(b) i=(b);i>=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

#define pb push_back
#define sz(a) ((int)a.size())
#define ms(a,n) memset(a, n, sizeof(a))
#define ms0(a) ms(a,0)
#define all(a) a.begin(), a.end()
#define sorts(a) sort(all(a))
#define sorta(a,n) sort(a,a+n)
#define sqr(a) ((a)*(a))
#define amax(a,b) ( (a) = max( (a) , (b) ) )
#define amin(a,b) ( (a) = min( (a) , (b) ) )
#define mp make_pair
#define abs(x) (((x)<0)?-(x):(x))
//#define lb(v,s) std::lower_bound (v.begin(), v.end(), s);
//#define ub(v,s) std::upper_bound (v.begin(), v.end(), s);

#define ff first
#define se second
//#define pi 2*acos(0.0)
#define pi 3.14159265358979
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define popcount(i) __builtin_popcount(i)                         //count one
#define parity(i)   __builtin_parity(i)       //evenparity 0 and odd parity 1
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)

//input
#define sfi(t) scanf("%d",&t)
#define sfii(a,b) scanf("%d %d",&a,&b)
#define sfiii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfll(t) scanf("%lld",&t)
#define sfllll(a,b) scanf("%lld %lld",&a,&b)
#define sfllllll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sfd(t) scanf("%lf",&t)
#define sfc(c) scanf("%c",&c)
#define sfs(s) scanf("%s",s)

//Output
#define pfi(a) printf("%d\n",a)
#define pfii(a,b) printf("%d %d\n",a,b)
#define pfiii(a,b,c) printf("%d %d %d\n",a,b,c)
#define pfll(a) printf("%lld\n",a)
#define pfllll(a,b) printf("%lld %lld\n",a,b)
#define pfllllll(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pfd(a) printf("%lf\n",a)
#define pfs(a) printf("%s\n",a)
#define pfis(a) printf("%d ",a)
#define pflls(a) printf("%lld ",a)
#define pfds(a) printf("%lf ",a)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef pair<ll,ll> pll;
typedef pair<string,int> psi;
typedef vector<pii> vii;
typedef set<int> si;
typedef set<string> ss;
typedef map<int,int> mii;
typedef map<string,int> msi;

//ll big_mod(ll b, ll p,ll Mod){if(p==1) return b;else if() if(p==0) return 1;ll x=pow(b,p/2,Mod);x=(x*x)%Mod;if(b&1) x=(x*a)%Mod;return x;}
//ll modInverse(ll a, ll m){return big_mod(a,m-2,m);}

#define dbg(x) cout<<#x<<'='<<x<<endl;
#define dbgarr(i,a) cout<<#a<<"["<<i<<"] = "<<a[i]<<" "<<endl;
#define maxll 9223372036854775807
#define minll -9223372036854775808
#define maxl 2147483647
#define minl -2147483648
#define mx7 10000007
#define mx6 1000006
#define mx5 100005
#define ret return

//double beg=clock();
//double end=clock();
//    fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
////CODE HERE

#define mx 46350
#define mod 1000000007

int main(){
    int n,m;
    while(sfii(n,m)==2){
        int a[3009];
        for(int i=1;i<=m;i++){
            sfi(a[i]);
        }
        sort(a,a+m+1);
        bool b=0;
        for(int i=1;i<=m-2;i++){
            if(((a[i+2]-a[i+1])==1) && ((a[i+1]-a[i])==1)){
                b=1;
                break;
            }
        }
        if(b==1){
            pfs("NO");
        }
        else{
            pfs("YES");
        }
    }
    return 0;
}


/******************************/
/**      SUMIT SAHA       **/
/**<< University Of Chittagong, BD >>/
/**   CSE 12th batch(11-12)    **/
/******************************/
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///printnewline
#define getint(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
void CI(int &_x) {
    scanf("%d",&_x);
}

void CO(int &_x) {
    cout<<_x;
}

template<typename T> void getarray(T a[],int n) {
    for(int i=0; i<n; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int n) {
    for(int i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

//_____________________________

int main() {
    //READ("input.txt");
    //WRITE("output.txt");
    vector<int>dirty;
    int n,d;
    cin>>n>>d;
    for(int i=1; i<=d; i++) {
        int temp;
        cin>>temp;
        dirty.PB(temp);

    }
    sort(dirty.begin(),dirty.end());
    if(dirty[0]==1||dirty[dirty.size()-1]==n) {
        puts("NO");
    }
    int prev_1=-100,prev_2=-200;
    for(int i=0; i<dirty.size(); i++) {

        if((prev_2+1)==(prev_1)&&(prev_1+1)==dirty[i])
        {
            puts("NO");
            return 0;
        }

        prev_2=prev_1;
        prev_1=dirty[i];

    }
    puts("YES");

    return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int N,M,b;
int d[3005];
int main()
{
 scanf("%d %d",&N,&M);
 for(int i=0;i<M;i++)
  scanf("%d",&d[i]);
 sort(d,d+M);
 if(!M)
  return printf("YES\n"),0;
 for(int i=1;i<M-1;i++)
 {
  if(d[i]-d[i-1] == 1 && d[i+1]-d[i]==1)
   return printf("NO\n"),0;
 }

  printf("YES\n");

 return 0;
}


/******************************/
/**      SUMIT SAHA       **/
/**<< University Of Chittagong, BD >>/
/**   CSE 12th batch(11-12)    **/
/******************************/
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///printnewline
#define getint(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
void CI(int &_x) {
    scanf("%d",&_x);
}

void CO(int &_x) {
    cout<<_x;
}

template<typename T> void getarray(T a[],int n) {
    for(int i=0; i<n; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int n) {
    for(int i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

//_____________________________

int main() {
    //READ("input.txt");
    //WRITE("output.txt");
    vector<int>dirty;
    int n,d;
    cin>>n>>d;
    for(int i=1; i<=d; i++) {
        int temp;
        cin>>temp;
        dirty.PB(temp);

    }
    if(d==0){
    puts("YES");
    return 0;
    }

    sort(dirty.begin(),dirty.end());

    if(dirty[0]==1||dirty[d-1]==n) {
        puts("NO");
        return 0;
    }
//    int prev_1=-100,prev_2=-200;
    for(int i=0; i<d-2; i++) {

        if(dirty[i]+2==dirty[i+2]){
        puts("NO");
        return 0;
        }
    }
    puts("YES");

    return 0;
}


/******************************/
/**      SUMIT SAHA       **/
/**<< University Of Chittagong, BD >>/
/**   CSE 12th batch(11-12)    **/
/******************************/
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///printnewline
#define getint(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
void CI(int &_x) {
    scanf("%d",&_x);
}

void CO(int &_x) {
    cout<<_x;
}

template<typename T> void getarray(T a[],int n) {
    for(int i=0; i<n; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int n) {
    for(int i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

//_____________________________

int main() {
    //READ("input.txt");
    //WRITE("output.txt");
    vector<int>dirty;
    int n,d;
    cin>>n>>d;
    for(int i=1; i<=d; i++) {
        int temp;
        cin>>temp;
        dirty.PB(temp);

    }
    sort(dirty.begin(),dirty.end());
    if(dirty[0]==1||dirty[dirty.size()-1]==n) {
        puts("NO");
    }
    int prev_1=-100,prev_2=-200;
    for(int i=0; i<dirty.size(); i++) {

        if(((prev_2+1)==(prev_1))&&((prev_1+1)==dirty[i]))
        {
            puts("NO");
            return 0;
        }

        prev_2=prev_1;
        prev_1=dirty[i];

    }
    puts("YES");

    return 0;
}


/******************************/
/**      SUMIT SAHA       **/
/**<< University Of Chittagong, BD >>/
/**   CSE 12th batch(11-12)    **/
/******************************/
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///printnewline
#define getint(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
void CI(int &_x) {
    scanf("%d",&_x);
}

void CO(int &_x) {
    cout<<_x;
}

template<typename T> void getarray(T a[],int n) {
    for(int i=0; i<n; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int n) {
    for(int i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

//_____________________________

int main() {
    //READ("input.txt");
    //WRITE("output.txt");
    vector<int>dirty;
    int n,d;
    cin>>n>>d;
    for(int i=1; i<=d; i++) {
        int temp;
        cin>>temp;
        dirty.PB(temp);

    }
//    puts("okk");
    sort(dirty.begin(),dirty.end());
//    for(int i=0; i<d; i++)
//    {
//        cout<<dirty[i]<<'\n';
//    }
    if(d==0) {
        puts("YES");
       return 0;
    }
    if(dirty[0]==1||dirty[dirty.size()-1]==n) {
        puts("NO");
    }
    int prev_1=-100,prev_2=-200;
    for(int i=0; i<dirty.size(); i++) {

        if(((prev_2+1)==(prev_1))&&((prev_1+1)==dirty[i])) {
            puts("NO");
            return 0;
        }

        prev_2=prev_1;
        prev_1=dirty[i];

    }
    puts("YES");

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <string.h>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define nln        puts("")                         ///printnewline
#define getInt(a)  scanf("%d",&a)
#define Max(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define Min(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

#define check(n, pos) (n & (1<<(pos)))       ///AND
#define biton(n, pos) (n | (1<<(pos)))       ///OR     }-bit opr.
#define bitoff(n, pos) (n & ~(1<<(pos)))     ///OFF

#define dbg(x) cout <<"Line= "<<__LINE__ <<" ->  "<< #x " = " << (x) << endl;

void CI(int &_x)
{
    scanf("%d",&_x);
}
void CI(int &_x,int &_y)
{
    CI(_x);
    CI(_y);
}
void CI(int &_x,int &_y,int &_z)
{
    CI(_x);
    CI(_y,_z);
}
void CI(int &_a,int &_b,int &_c,int &_d)
{
    CI(_a,_b);
    CI(_c,_d);
}

template<typename T> void getarray(T a[],int b,int e)
{
    for(int i=b; i<e+b; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int b,int e)
{
    for(int i=b; i<e-1+b; i++) cout<<a[i]<<" ";
    cout<<a[e-1+b]<<endl;
}
template <typename T> T BigMod (T b,T p,T m)
{
    if (p == 0) return 1;
    if (p%2 == 0)
    {
        T s = BigMod(b,p/2,m);
        return ((s%m)*(s%m))%m;
    }
    return ((b%m)*(BigMod(b,p-1,m)%m))%m;
}
template <typename T> T ModInv (T b,T m)
{
    return BigMod(b,m-2,m);
}

const double EPS=1e-9;                       ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

int semiR[4]={2,2,-2,-2};
int semiC[4]={2,-2,2,-2};

char board[9][9];
int mark1[9][9];
int mark2[9][9];

void visit1(int rr,int cc,int s)
{
    mark1[rr][cc]=s++;
    for(int i=0;i<4;i++)
    {
        int c=cc+semiC[i];
        int r=rr+semiR[i];
        if(c>=1&&c<=8&&r>=1&&r<=8&&!mark1[r][c])
        {
            visit1(r,c,s);
        }
    }
    return;
}

void visit2(int rr,int cc,int s)
{
    mark2[rr][cc]=s++;;
    for(int i=0;i<4;i++)
    {
        int c=cc+semiC[i];
        int r=rr+semiR[i];
        if(c>=1&&c<=8&&r>=1&&r<=8&&!mark2[r][c])
        {
            visit2(r,c,s);
        }
    }
    return;
}

int main()
{
    //READ("input.txt");
    int kase;
    int i,j,k;
    int Kx1,Ky1;
    int Kx2,Ky2;
    CI(kase);
    getchar();
    while(kase--)
    {
        k=0;
        for(i=1;i<=8;i++)
        {
            for(j=1;j<=8;j++)
            {
                board[i][j]=getchar();
                if(board[i][j]=='K')
                {
                    if(k==0)
                    {
                        Kx1=i;
                        Ky1=j;
                        k++;
                    }
                    else
                    {
                        Kx2=i;
                        Ky2=j;
                    }
                }
            }
            getchar();
        }

        MEM(mark1,0);
        MEM(mark2,0);
        visit1(Kx1,Ky1,0);
        visit2(Kx2,Ky2,0);
        bool found=0;
        for(i=1;i<=8;i++)
        {
            for(j=1;j<=8;j++)
            {
                if(mark1[i][j]!=0&&mark1[i][j]==mark2[i][j])
                {
                    if(board[i][j]!='#')
                    {
                        cout<<"YES\n";
                        return 0;

                    }

                    else
                    {
                        for(int h=0;h<4;h++)
                        {
                            int ii,jj;
                            ii=i+semiR[h];
                            jj=j+semiC[h];
                            if(board[ii][jj]!='#')
                            {
                                 cout<<"YES\n";
                        return 0;
                            }

                        }
                    }
                }

            }
        }

//        if(found)
//        {
//            cout<<"YES\n";
//        }
       \
            cout<<"NO\n";

        getchar();
    }

}


/******************************/
/**      SUMIT SAHA       **/
/**<< University Of Chittagong, BD >>/
/**   CSE 12th batch(11-12)    **/
/******************************/
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///printnewline
#define getint(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
void CI(int &_x) {
    scanf("%d",&_x);
}

void CO(int &_x) {
    cout<<_x;
}

template<typename T> void getarray(T a[],int n) {
    for(int i=0; i<n; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int n) {
    for(int i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

//_____________________________

int main() {
    //READ("input.txt");
    //WRITE("output.txt");
    vector<int>dirty;
    int n,d;
    cin>>n>>d;
    for(int i=1; i<=d; i++) {
        int temp;
        cin>>temp;
        dirty.PB(temp);

    }
//    puts("okk");
    sort(dirty.begin(),dirty.end());
//    for(int i=0; i<d; i++)
//    {
//        cout<<dirty[i]<<'\n';
//    }
    if(d==0) {
        puts("YES");
       return 0;
    }
    if(dirty[0]==1||dirty[dirty.size()-1]==n) {
        puts("NO");
    }
    int prev_1=-100,prev_2=-200;
    for(int i=0; i<d-2; i++) {

        if(dirty[i]+2==dirty[i+2]){
        puts("NO");
        return 0;
        }
    }
    puts("YES");

    return 0;
}


/******************************/
/**      SUMIT SAHA       **/
/**<< University Of Chittagong, BD >>/
/**   CSE 12th batch(11-12)    **/
/******************************/
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;

#define nln        puts("")                         ///printnewline
#define getint(a)  scanf("%d",&a);
#define max3(a,b,c) max(a,max(b,c))                  ///3 ta theke max
#define min3(a,b,c) min(a,min(b,c))                  ///3 ta theke min

#define FOR1(i,n)  for(i=1;i<=n;i++)
#define FOR0(i,n)  for(i=0;i<n;i++)                 ///looping
#define FORR(i,n)  for(i=n-1;i>=0;i--)
#define ALL(p)     p.begin(),p.end()

#define SET(p)     memset(p,-1,sizeof(p))
#define CLR(p)     memset(p,0,sizeof(p))            ///memset
#define MEM(p,v)   memset(p,v,sizeof(p))

#define READ(f)    freopen(f, "r", stdin)           /// file
#define WRITE(f)   freopen(f, "w", stdout)

#define SZ(c)      (int)c.size()
#define PB(x)      push_back(x)                     ///STL defines
#define MP(x,y)    make_pair(x,y)
#define ff         first
#define ss         second

#define LI         long int
#define LLI        long long int
#define f64        long double
#define PI         acos(-1.0)                        ///PI er value

int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}
void CI(int &_x) {
    scanf("%d",&_x);
}

void CO(int &_x) {
    cout<<_x;
}

template<typename T> void getarray(T a[],int n) {
    for(int i=0; i<n; i++) cin>>a[i];
}
template<typename T> void printarray(T a[],int n) {
    for(int i=0; i<n-1; i++) cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
}

const double EPS=1e-9;                              ///constatnts
const int INF=0x7f7f7f7f;

int dr8[8]= {1,-1,0,0,1,-1,-1,1};            ///8 direction move
int dc8[8]= {0,0,-1,1,1,1,-1,-1};
int dr4[4]= {0,0,1,-1};                      ///4 direction move
int dc4[4]= {-1,1,0,0};                      ///or adjacent dir.
int kn8r[8]= {1,2,2,1,-1,-2,-2,-1};          ///knight moves
int kn8c[8]= {2,1,-1,-2,-2,-1,1,2};

//_____________________________

int main() {
    //READ("input.txt");
    //WRITE("output.txt");
    vector<int>dirty;
    int n,d;
    cin>>n>>d;
    for(int i=1; i<=d; i++) {
        int temp;
        cin>>temp;
        dirty.PB(temp);

    }
//    puts("okk");
    sort(dirty.begin(),dirty.end());

    if(dirty[0]==1||dirty[d-1]==n) {
        puts("NO");
        return 0;
    }
//    int prev_1=-100,prev_2=-200;
    for(int i=0; i<d-2; i++) {

        if(dirty[i]+2==dirty[i+2]){
        puts("NO");
        return 0;
        }
    }
    puts("YES");

    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];
bool used[100001];
main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;
    for(i=1;i<=m;i++)
        cin>>w[i];
    sort(w+1,w+m+1);
          used[1]=1;
    for(i=1;i<=m;i++)
    {
      if(w[i]+1!=w[i+1] && w[i]+1-cur<=3)
      {
          cur=w[i]+1;
          v[cur]=1;
      }
//      cout<<cur<<" ";
    }
    for(i=w[n]+1;i<=n;i++)
    {
        used[i]=1;
    }
   if(used[n])
    cout<<"YES";
    else
        cout<<"NO";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];
bool used[100001];
main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;
    for(i=1;i<=m;i++)
        cin>>w[i];
    sort(w+1,w+m+1);
          used[1]=1;
    for(i=1;i<=m;i++)
    {
      if(w[i]+1!=w[i+1] && w[i]+1-cur<=3)
      {
          cur=w[i]+1;
          used[cur]=1;
      }
//      cout<<cur<<" ";
    }
    for(i=w[n]+1;i<=n;i++)
    {
        used[i]=1;
    }
   if(used[n])
    cout<<"YES";
    else
        cout<<"NO";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];

main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;

    for(i=1; i<=m; i++)
        cin>>w[i];
    sort(w+1,w+m+1);
    for(i=1; i<=m; i++)
    {
        if(w[i]==n)
        {
            cout<<"NO";
            return 0;
        }
    }
    if(n==1 && w[1]!=1)
    {
        cout<<"YES";
        return 0;
    }
    for(i=1; i<=m; i++)
    {
        if(w[i]+1==w[i+1] && w[i+1]+1==w[i+2])
        {
            cout<<"NO";
            return 0;
        }
//      cout<<cur<<" ";
    }
    cout<<"YES";

}


#include<iostream>
#include<algorithm>
using namespace std;

int w[100001];
main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;
    for(i=1;i<=m;i++)
        cin>>w[i];
    sort(w+1,w+m+1);
    for(i=1;i<=m;i++)
    {
      if(w[i]+1!=w[i+1] && w[i]+1-cur<=3)
      {
          cur=w[i]+1;
      }

    }
   if(cur==n)
    cout<<"YES";
    else
        cout<<"NO";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];
vector<char>v(100001,false);
main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;
    for(i=1;i<=m;i++)
        cin>>w[i];
    sort(w+1,w+m+1);
          v[1]=1;
    for(i=1;i<=m;i++)
    {
      if(w[i]+1!=w[i+1] && w[i]+1-cur<=3)
      {
          cur=w[i]+1;
          v[cur]=1;
      }
//      cout<<cur<<" ";
    }
   if(v[n])
    cout<<"YES";
    else
        cout<<"NO";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];

main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;

    for(i=1; i<=m; i++)
        cin>>w[i];
    sort(w+1,w+m+1);
    for(i=1; i<=m; i++)
    {
        if(w[i]==n)
        {
            cout<<"NO";
            return 0;
        }
    }
    for(i=1; i<=m; i++)
    {
      if(w[i]+1==w[i+1] && w[i+1]+1==w[i+2])
      {
          cout<<"NO";
          return 0;
      }
//      cout<<cur<<" ";
    }
    cout<<"YES";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];

main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;

    for(i=1; i<=m; i++)
        cin>>w[i];
    sort(w+1,w+m+1);
    if(w[1]==1)
    {
        cout<<"NO";
        return 0;
    }
    for(i=1; i<=m; i++)
    {
        if(w[i]==n)
        {
            cout<<"NO";
            return 0;
        }
    }
    if(n==1 && w[1]!=1)
    {
        cout<<"YES";
        return 0;
    }
    for(i=1; i<=m; i++)
    {
        if(w[i]+1==w[i+1] && w[i+1]+1==w[i+2])
        {
            cout<<"NO";
            return 0;
        }
        if(w[i]>n && w[i-1]<n)
        {
            cout<<"YES";
            return 0;
        }
//      cout<<cur<<" ";
    }
    cout<<"YES";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];
main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;

    for(i=1;i<=m;i++)
        cin>>w[i];
    sort(w+1,w+m+1);
   for(i=1;i<=m;i++)
   {
       if(w[i]==n)
       {
           cout<<"NO";
           return 0;
       }
   }
    for(i=1;i<=m;i++)
    {
      if(w[i]+1!=w[i+1] && w[i]+1-cur<=3)
      {
          cur=w[i]+1;
      }
      else if(w[i]+1!=w[i+1] && w[i+1]-cur>3)
      {
          cout<<"NO";
          return 0;
      }
//      cout<<cur<<" ";
    }
  cout<<"YES";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];

main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;

    for(i=1; i<=m; i++)
        cin>>w[i];
    sort(w+1,w+m+1);
    for(i=1; i<=m; i++)
    {
        if(w[i]==n)
        {
            cout<<"NO";
            return 0;
        }
    }
    if(n==1 && w[1]!=1)
    {
        cout<<"YES";
        return 0;
    }
    for(i=1; i<=m; i++)
    {
        if(w[i]+1==w[i+1] && w[i+1]+1==w[i+2])
        {
            cout<<"NO";
            return 0;
        }
        if(w[i]>n && w[i-1]<n)
        {
            cout<<"YES";
            return 0;
        }
//      cout<<cur<<" ";
    }
    cout<<"YES";

}


#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int w[100001];
bool used[100001];
main()
{
    int n, m, i, cur = 1,t = 1;
    cin>>n>>m;
    for(i=1;i<=m;i++)
        cin>>w[i];
    sort(w+1,w+m+1);
          used[1]=1;
    for(i=1;i<=m;i++)
    {
      if(w[i]+1!=w[i+1] && w[i]+1-cur<=3)
      {
          cur=w[i]+1;
          used[cur]=1;
      }
      else if(w[i]+1!=w[i+1] && w[i+1]-cur>3)
      {
          cout<<"NO";
          return 0;
      }
//      cout<<cur<<" ";
    }
  cout<<"YES";

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    if (m<=2)
    {
        cout<<"YES";
        return 0;
    }
    vector<int> a;
    while(m--)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (a[a.size()-1]==n or a[0]==1)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> a;
    while(m--)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (a[a.size()-1]==n or a[0]==1)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> a;
    while(m--)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (a[a.size()-1]==n or a[0]==1)
    {
        cout<<"NO";
        return 0;
    }
    if (m<=2)
    {
        cout<<"YES";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> a;
    for(int i=1;i<=m;i++)
    {
        int x;
        cin>>x;
        if (x==1 or x==n)
        {
            cout<<"NO";
            return 0;
        }
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (m<=2)
    {
        cout<<"YES";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> a;
    while(m--)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (a[a.size()-1]==n)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> a;
    while(m--)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
    {
        cout<<"NO";
        return 0;
    }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> a;
    for(int i=1;i<=m;i++)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (a[a.size()-1]==n or a[0]==1)
    {
        cout<<"NO";
        return 0;
    }
    if (m<=2)
    {
        cout<<"YES";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    if (!m)
    {
        cout<<"YES";
        return 0;
    }
    vector<int> a;
    while(m--)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    if (a[a.size()-1]==n or a[0]==1)
    {
        cout<<"NO";
        return 0;
    }
    for(int i=0;i<a.size()-2;i++)
        if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
        {
            cout<<"NO";
            return 0;
        }
    cout<<"YES";
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long int n;
    long int m;
    cin >> n >> m;
    vector<long int> v(m);
    vector<long int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-3; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else{
    if((v[0]==1 or v[m-1]==n) or (n<3 and (v[0]==1 or v[0]==n)))
        cout << "NO" << endl;
        else{
    diff[0] = 0;
    for(int i = 1; i < m; i++)
    {
        diff[i] = v[i]-v[i-1];
    }
    int ans = 0;
    for(int s = 0; s < diff.size()-2; s++)
    {
            //cout << diff[s] << endl;
        if(diff[s]+diff[s+1]+diff[s+2] >= 3)
            ans++;
    }
    if(ans==v.size()-2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    }
}

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-3; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long int n;
    long int m;
    cin >> n >> m;
    vector<long int> v(n);
    vector<long int> diff(n);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.begin()+m);
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-2; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if((v[0]==1 and v[m-1]==n) or (v[0]==1 or v[m-1]==n) or (n<3 and (v[0]==1 or v[0]==n)))
        cout << "NO" << endl;
    else{
        if(m==0) cout << "YES" << endl;
        else{
    diff[0] = 0;
    for(int i = 1; i < m; i++)
    {
        diff[i] = v[i]-v[i-1];
    }
    int ans = 0;
    for(int s = 0; s < diff.size()-2; s++)
    {
            //cout << diff[s] << endl;
        if(diff[s]+diff[s+1]+diff[s+2] >= 3)
            ans++;
    }
    if(ans==v.size()-2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    }
}
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long int n;
    long int m;
    cin >> n >> m;
    vector<long int> v(n);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.begin()+m);
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-2; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==1) cout << "YES" << endl;
    else{
    if((v[0]==1 and v[m-1]==n) or (v[0]==1 or v[m-1]==n) or (n<3 and (v[0]==1 or v[0]==n)))
        cout << "NO" << endl;
        else{
    diff[0] = 0;
    for(int i = 1; i < m; i++)
    {
        diff[i] = v[i]-v[i-1];
    }
    int ans = 0;
    for(int s = 0; s < diff.size()-2; s++)
    {
            //cout << diff[s] << endl;
        if(diff[s]+diff[s+1]+diff[s+2] >= 3)
            ans++;
    }
    if(ans==v.size()-2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    }
}

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long int n;
    long int m;
    cin >> n >> m;
    vector<long int> v(n);
    vector<long int> diff(n);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-2; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if((v[0]==1 and v[m-1]==n) or (v[0]==1 or v[m-1]==n))
        cout << "NO" << endl;
    else{
    diff[0] = 0;
    for(int i = 1; i < m; i++)
    {
        diff[i] = v[i]-v[i-1];
    }
    int ans = 0;
    for(int s = 0; s < diff.size()-2; s++)
    {
            //cout << diff[s] << endl;
        if(diff[s]+diff[s+1]+diff[s+2] >= 3)
            ans++;
    }
    if(ans==v.size()-2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long int n;
    long int m;
    cin >> n >> m;
    vector<long int> v(m);
    vector<long int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-2; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long int n;
    long int m;
    cin >> n >> m;
    vector<long int> v(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-2; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else{
    if((v[0]==1 and v[m-1]==n) or (v[0]==1 or v[m-1]==n) or (n<3 and (v[0]==1 or v[0]==n)))
        cout << "NO" << endl;
        else{
    diff[0] = 0;
    for(int i = 1; i < m; i++)
    {
        diff[i] = v[i]-v[i-1];
    }
    int ans = 0;
    for(int s = 0; s < diff.size()-2; s++)
    {
            //cout << diff[s] << endl;
        if(diff[s]+diff[s+1]+diff[s+2] >= 3)
            ans++;
    }
    if(ans==v.size()-2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    }
}

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if(m==0) cout << "YES" << endl;
    else
    {
        if(m==1)
        {
            if(v[0]==1 or v[0]==n)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==2)
        {
            if((v[0]==1 and v[1]!=n) or (v[0]!=1 and v[1]==n) or (v[0]==1 and v[1]==n) )
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
        }
        if(m==3)
        {
            if((v[0]==1 and v[2]!=n) or (v[0]!=1 and v[2]==n) or (v[0]==1 and v[2]==n) )
                cout << "NO" << endl;
            else
            {
                if(v[0]+1==v[1] and v[1]+1==v[2])
                    cout << "NO" << endl;
                else
                    cout << "YES" << endl;
            }
        }
        if(m>3)
        {
            if((v[0]==1 and v[m-1]!=n) or (v[0]!=1 and v[m-1]==n) or (v[0]==1 and v[m-1]==n) )
                cout << "NO" << endl;
            else
            {
                for(int x = 0; x < m-3; x++)
                {
                    if(v[x+1]==v[x]+1 and v[x+2]==v[x+1]+1)
                    {
                            cout << "NO" << endl;
                            goto end;
                    }
                }
                cout << "YES" << endl;
            }
        }
    }
    end:
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v(m);
    vector<int> diff(m);
    for(int i = 0; i< m; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    if((v[0]==1 and v[m-1]==n) or (v[0]==1 or v[m-1]==n))
        cout << "NO" << endl;
    else{
    diff[0] = 0;
    for(int i = 1; i < m; i++)
    {
        diff[i] = v[i]-v[i-1];
    }
    int ans = 0;
    for(int s = 0; s < diff.size()-3; s++)
    {
        if(v[s]+v[s+1]+v[s+2] >= 3)
            ans++;
    }
    if(ans==v.size()-2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int a[3000], n, m;

int main ()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        cin >> a[i];
        if(a[i] == 1 || a[i] == n)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    sort(a, a + m);
    for(int i = 2; i <= m; i++)
    {
        if(a[i - 1] == a[i] - 1 && a[i - 2] == a[i - 1] - 1)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    cout << "YES";
    //while(9);
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int a[3000], n, m;

int main ()
{
    cin >> n >> m;
    a[0] = 1;
    a[m] = n;
    for(int i = 1; i <= m; i++)
    {
        //cout << "fgdg" << endl;
        cin >> a[i];
        if(a[i] == 1 || a[i] == n)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    sort(a, a + m);
    /*for(int i = 0; i < m; i++)
    {
        cout << a[i] << ' ';
    }
    cout << endl;*/
    if(m < 3)
    {
        cout << "YES";
        return 0;
    }
    for(int i = 3; i <= m; i++)
    {
        cout << a[i] << ' ' << a[i - 1] << ' ' << a[i - 2] << ' ' << a[i - 3] << endl;
        if(a[i - 1] == a[i] - 1 && a[i - 2] == a[i - 1] - 1 && a[i - 3] == a[i - 2] - 1)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    cout << "YES";
    //while(9);
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int a[3000], n, m;

int main ()
{
    cin >> n >> m;
    a[0] = 1;
    a[m + 1] = n;
    for(int i = 1; i <= m; i++)
    {
        cin >> a[i];
        if(a[i] == 1 || a[i] == n)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    sort(a, a + m + 1);
    for(int i = 2; i <= m + 1; i++)
    {
        if(a[i - 1] == a[i] - 1 && a[i - 2] == a[i - 1] - 1)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    cout << "YES";
    //while(9);
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int a[3000], n, m;

int main ()
{
    cin >> n >> m;
    if(m < 3)
    {
        cout << "YES";
        //while(8);
        return 0;
    }
    a[0] = 1;
    a[m + 1] = n;
    for(int i = 1; i <= m; i++)
    {
        cin >> a[i];
        if(a[i] == 1 || a[i] == n)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    sort(a, a + m + 1);
    for(int i = 2; i <= m; i++)
    {
        if(a[i - 1] == a[i] - 1 && a[i - 2] == a[i - 1] - 1)
        {
            cout << "NO";
            //while(9);
            return 0;
        }
    }
    cout << "YES";
    //while(9);
    return 0;
}


/**Codefroces<710 c>**/
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int array[50][50];
int n;
int lao_bo_er(int n,int x,int y,int num)
{
    int i=y;
    int j=(n/2)+x;
    for(int k=num; k<=num+(n*n)-1; k++)
    {
         array[i][j]=k;
         if((k-1+num)%n==0)
          i=(i-y+1)%n+y;
         else
         {
              i=(i-1-y+n)%n+y;
              j=(j-x+1)%n+x;
         }
    }
}
int main()
{
    while(~scanf("%d",&n))
    {
        memset(array,0,sizeof(array));
        lao_bo_er(n,1,1,1);
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
            {
                 if(j==n)  printf("%d\n",array[i][j]);
                 else   printf("%d ",array[i][j]);
            }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int array[50][50];
int test_print(int x, int y, int w, int h)            //测试用的，输出以（x，y）为原点，宽为w，高为h，这个区域的数值
{
    int i;
    int j;
    for(i=y; i<=y+h-1; i++)
    {
        for(j=x; j<=x+w-1; j++)
        {
            printf("%d ",array[i][j]);
        }
        printf("\n");
    }
    return 0;
}
int lao_bo_er(int degree, int x, int y, int num)      //劳伯法
{
    int i,j,k;
    i = y;
    j = degree/2 + x;
    for(k=num; k<=num+degree*degree-1; k++)
    {
        array[i][j] = k;
        if((k-num+1)%degree == 0)             //如果这个数所要放的格已经有数填入
        {
            i = (i-y+1)%degree+y;
        }
        else                                  //每一个数放在前一个数的右上一格
        {
            i = (i-y-1+degree)%degree+y;
            j = (j-x+1)%degree+x;
        }
    }
    return 0;
}
int seq_range(int degree)                             //把数字按顺序填
{
    int i;
    int j;
    int num;
    num = 1;
    for(i=1; i<=degree; i++)
    {
        for(j=1; j<=degree; j++)
        {
            array[i][j] = num++;
        }
    }
    return 0;
}

int si_te_la_zi(int degree, int x, int y, int num)    //斯特拉兹法
{
    int deg;
    int k;
    int temp;
    int i;
    int j;

    deg = degree/2;
    lao_bo_er(deg, x, y, num);                    //用罗伯法，依次在A象限，D象限，B象限，C象限按奇数阶幻方的填法填数
    lao_bo_er(deg, x+deg, y, num+2*deg*deg);
    lao_bo_er(deg, x, y+deg, num+3*deg*deg);
    lao_bo_er(deg, x+deg, y+deg, num+deg*deg);
    k = (degree-2)/4;
    for(i=1; i<=deg; i++)                         //A象限和C象限对换数据
    {
        for(j=1; j<=k; j++)
        {
            temp = array[i][j];
            array[i][j] = array[i+deg][j];
            array[i+deg][j]=temp;
        }
        for(j=deg+deg/2+1; j>=deg+deg/2-k+3; j--)
        {
            temp = array[i][j];
            array[i][j] = array[i+deg][j];
            array[i+deg][j]=temp;
        }
    }
    for(i=j=1; j<=deg/2+k; j++)                   //B象限和D象限对换数据
    {
        temp = array[i+deg/2][j];
        array[i+deg/2][j] = array[i+deg+deg/2][j];
        array[i+deg+deg/2][j]=temp;
    }

    return 0;
}

int hai_er_fa(int degree)                             //海尔法
{
    int i;
    int j;
    int complement;
    int deg;

    seq_range(degree);
    complement = degree*degree+1;
    deg = degree/4;
    for(i=0; i<deg; i++)
    {
        for(j=0; j<deg; j++)                  //对角线上的数字换成和它互补的数
        {
            array[i*4+1][j*4+1] = complement - array[i*4+1][j*4+1];
            array[i*4+1][j*4+4] = complement - array[i*4+1][j*4+4];
            array[i*4+4][j*4+1] = complement - array[i*4+4][j*4+1];
            array[i*4+4][j*4+4] = complement - array[i*4+4][j*4+4];

            array[i*4+2][j*4+2] = complement - array[i*4+2][j*4+2];
            array[i*4+2][j*4+3] = complement - array[i*4+2][j*4+3];
            array[i*4+3][j*4+2] = complement - array[i*4+3][j*4+2];
            array[i*4+3][j*4+3] = complement - array[i*4+3][j*4+3];
        }
    }
    return 0;
}

int main()
{
    int degree;
    while(~scanf("%d",&degree)){
    memset(array,0,sizeof(array));
    if(degree%2 == 1)                             //奇数阶幻方
    {
        lao_bo_er(degree,1,1,1);
        test_print(1,1,degree,degree);
    }
    else if(degree%4 == 2)                        //双偶阶幻方
    {
        si_te_la_zi(degree, 1, 1, 1);
        test_print(1,1,degree,degree);
    }
    else                                          //单偶阶幻方
    {
        hai_er_fa(degree);
        test_print(1,1,degree,degree);
    }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int array[50][50];
int n;
int lao_bo_er(int n,int x,int y,int num)
{
    int i=y;
    int j=(n/2)+x;
    for(int k=num; k<=num+(n*n)-1; k++)
    {
         array[i][j]=k;
         if((k-1+num)%n==0)
          i=(i%n)%n+y;
         else
         {
              i=(i%n+n)%n+y;
              j=(j%n)%n+x;
         }
    }
}
int main()
{
    while(~scanf("%d",&n))
    {
        memset(array,0,sizeof(array));
        lao_bo_er(n,1,1,1);
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
            {
                 if(j==n)  printf("%d\n",array[i][j]);
                 else   printf("%d ",array[i][j]);
            }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int array[50][50];
int n;
int lao_bo_er(int n,int x,int y,int num)
{
    int i=y;
    int j=(n/2)+x;
    for(int k=num; k<=num+(n*n)-1; k++)
    {
         array[i][j]=k;
         if((k-1+num)%n==0)
          i=(i+1-y)%n+y;
         else
         {
              i=(i-1-y+n)%n+y;
              j=(j+1-x)%n+x;
         }
    }
}
int main()
{
    while(~scanf("%d",&n))
    {
        memset(array,0,sizeof(array));
        lao_bo_er(n,1,1,1);
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
            {
                 if(j==n)  printf("%d\n",array[i][j]);
                 else
                printf("%d ",array[i][j]);
            }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int odd = 1, even = 2;
    bool flag = true;
    for(int i=1;i<=n && i>=1; flag?(i++):(i--))
    {
            for(int k=1;k<=(n-2*i+1)/2;k++) printf("%d%c",even,' '), even +=2;
            for(int k=1;k<=2*i-1;k++) printf("%d%c",odd,' '),odd+=2;
            for(int k=1;k<=(n-2*i+1)/2;k++) printf("%d%c",even,(k==(n-2*i+1)/2)?'\n':' '),even+=2;
            if( i == (n/2 + 1)) flag = false,printf("\n");
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int odd = 1, even = 2;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if( i == n/2 + 1) printf("%d",odd),odd+=2;
            else
            {
                if(j&1) printf("%d",even),even+=2;
                else printf("%d",odd),odd+=2;
            }
            printf("%c",j==n?'\n':' ');
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int odd = 1, even = 2;
    bool flag = true;
    for(int i=1;i<=n && i>=1; flag?(i++):(i--))
    {
            for(int k=1;k<=(n-2*i+1)/2;k++) printf("%d%c",even,' '), even +=2;
            for(int k=1;k<=2*i-1;k++) printf("%d%c",odd,' '),odd+=2;
            for(int k=1;k<=(n-2*i+1)/2;k++) printf("%d%c",even,(k==(n-2*i+1)/2)?'\n':' '),even+=2;
            if( i == (n/3 + 1)) flag = false,printf("\n");
    }
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<map>
using namespace std;

bool ma[50][50];

int main()
{
	int n;
	scanf("%d", &n);

	memset(ma, 0, sizeof ma);

	for (int i = 0;i < n;i++)
	{
		ma[n / 2][i] = 1;
		ma[i][n / 2] = 1;
	}

	int amount1 = (n - 1)*(n - 3) / 2;
	amount1 /= 4;

	int keyx = 0;
	int keyy = 0;
	while (amount1--)
	{
		ma[keyx][keyy] = 1;
		ma[n - 1 - keyx][keyy] = 1;
		ma[keyx][n - 1 - keyy] = 1;
		ma[n -1- keyx][n -1- keyy] = 1;
		keyy++;
		if (keyy >= n / 2)
		{
			keyx++;
			keyy = 0;
		}
	}

	int x = 1;
	int y = 2;

	for (int i = 0;i < n;i++)
	{
		for (int j = 0;j < n;j++)
		{
			//printf("%d ", ma[i][j]);

			if (ma[i][j] == 0)
			{
				printf("%d ", y);
				y += 2;
			}
			else
			{
				printf("%d ", x);
				x += 2;
			}
		}
		printf("\n");
	}

	return 0;
}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    scanf ("%d", &n);
    int a[100][100];
    int n1=1,n2=2;
    memset(a,0,sizeof(a));
    for (int i = 1; i <= n/2+1; i ++)
        for (int j = n/2+2-i; j <= n/2+i; j ++)
            a[i][j]=a[n-i+1][j]=1;

    for (int i=1;i<=n;i++){
        for (int j=1;j<=n;j++)
            if (a[i][j]){
                cout<<n1<<" ";
                n1+=2;
            }
            else{
                cout<<n2<<" ";
                n2+=2;
            }
        cout<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <math.h>

using namespace std;

int main() {
    int n;
    scanf("%d",&n);
    int odd = 1, even = 2;
    int t = 1;
    for(int i = 0;i< n/2;i++,t +=2){
        for(int j = 0;j < n;j++){
            if(j >=(n-t)/2 && j < (n+t)/2){
                printf("%d",odd);
                odd+=2;
            }
            else{
                printf("%d",even);
                even+=2;
            }
            if(j!=n-1){
                printf(" ");
            }
            else{
                printf("\n");
            }
        }
    }
    for(int i = 1;i < n;i++){
        printf("%d ",odd);
        odd+=2;
    }
    printf("%d\n",odd);
    odd+=2;
    t-=2;
    for(int i = 0;i< n/2;i++,t -=2){
        for(int j = 0;j < n;j++){
            if(j >=(n-t)/2 && j < (n+t)/2){
                printf("%d",odd);
                odd+=2;
            }
            else{
                printf("%d",even);
                even+=2;
            }
            if(j!=n-1){
                printf(" ");
            }
            else{
                printf("\n");
            }
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <math.h>

using namespace std;

int main() {
    int n;
    scanf("%d",&n);
    int odd = 1, even = 2;
    int t = 1;
    for(int i = 0;i< n/2;i++,t +=2){
        for(int j = 0;j < n;j++){
            if(j >=(n-t)/2 && j < (n+t)/2){
                printf("%d",odd);
                odd+=2;
            }
            else{
                printf("%d",even);
                even+=2;
            }
            if(j!=n-1){
                printf(" ");
            }
            else{
                printf("\n");
            }
        }
    }
    for(int i = 1;i < n;i++){
        printf("%d ",odd);
        odd+=2;
    }
    printf("%d\n",odd);
    odd+=2;
    for(int i = 0;i< n/2;i++,t -=2){
        for(int j = 0;j < n;j++){
            if(j >=(n-t)/2 && j < (n+t)/2){
                printf("%d",odd);
                odd+=2;
            }
            else{
                printf("%d",even);
                even+=2;
            }
            if(j!=n-1){
                printf(" ");
            }
            else{
                printf("\n");
            }
        }
    }
    return 0;
}


#include <cstdio>
int main(){
    int n;
    scanf("%d",&n);
    int id=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            id++;
            printf("%d ",id%(n*n)+1);
        }
        printf("\n");
    }
    scanf("%d",&n);
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,a[50][50]={0},x=1,y;
int main()
{
	scanf("%d",&n);
	y=n/2+1;
	for(int i=1;i<=n*n;i++)
	{
		a[x][y]=i;
		x--;
		y++;
		if((x<=0&&y>n)||a[x][y]!=0)
		{
			x+=2;
			y--;
		}
		else if(x<=0)
			x=n;
		else if(y>n)
			y=1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
			printf("%d ",a[i][j]);
		printf("\n");
	}
	return 0;
}


#include <iostream>
using namespace std;
int m[50][50];
int main() {
	int a, b, n; cin >> n;
	int odd = 1, even = 2;
	for (int i = 0; i < n; ++i) {
		if (n / 2 >= i) {
			a = n / 2 - i;
			b = n / 2 + i;
		} else {
			a = i - n / 2;
			b = n - a - 1;
		}
		for (int j = a; j <= b; ++j) {
			m[i][j] = odd;
			odd += 2;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (m[i][j]) continue;
			m[i][j] = even;
			even += 2;
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j) cout << " ";
			cout << m[i][j];
		}
		cout << "\n";
	}
	//system("pause");
	return 0;
}


#include <iostream>
using namespace std;
int m[50][50] = {0};
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	int flag = 0, odd = 1, even = 2;
	m[n >> 1][n >> 1] = n * n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			flag = !flag;
			if (m[i][j]) continue;
			if (flag) { m[i][j] = even; even += 2; }
			else { m[i][j] = odd; odd += 2; }
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j) cout << " ";
			cout << m[i][j];
		}
		cout << "\n";
	}
	//system("pause");
	return 0;
}


#include <iostream>
using namespace std;
int m[50][50] = {0};
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	int flag = !((n >> 1) & 1), odd = 1, even = 2;
	m[n >> 1][n >> 1] = n * n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			flag = !flag;
			if (m[i][j]) continue;
			if (flag) { m[i][j] = even; even += 2; }
			else { m[i][j] = odd; odd += 2; }
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j) cout << " ";
			cout << m[i][j];
		}
		cout << "\n";
	}
	//system("pause");
	return 0;
}


/***بسم اللله الرحمن الرحيم** */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,even =2,odd=1,no=1;
int main()
{
//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
cin>>n;
for(int i=0;i<n/2+1;i++)
{
    for(int j=0;j<n/2-i;j++){cout<<even<<" ";even+=2;}
     for(int j=0;j<no;j++){cout<<odd<<" ";odd+=2;}
      no+=2;
        for(int j=0;j<n/2-i;j++){cout<<even<<" ";even+=2;}
         cout<<endl;
}
no-=4;
for(int i=0;i<n/2;i++)
{
    for(int j=0;j<(n-no)/2;j++){cout<<even<<" ";even+=2;}
         for(int j=0;j<no;j++){cout<<odd<<" ";odd+=2;}
         for(int j=0;j<(n-no)/2;j++){cout<<even<<" ";even+=2;}
                   no-=2;
                    cout<<endl;
}
 return 0;
}


/***بسم اللله الرحمن الرحيم** */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,cnt=1,a[49][49];
int main()
{
//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
cin>>n;
for(int i=0;i<n;i++){a[i][n/2]=cnt;cnt+=2;}
for(int i=0;i<n;i++){if(i!=n/2){a[n/2][i]=cnt;cnt+=2;}}
cnt=2;
 for(int i=0;i<n;i++)
 {
     for(int j=0;j<n;j++) {if(a[i][j]==0)a[i][j]=cnt; cout<<a[i][j]<<" "; cnt+=2;}
             cout<<endl;
 }
 return 0;
}


/***بسم اللله الرحمن الرحيم** */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,cnt=1,a[49][49];
int main()
{
//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
cin>>n;
for(int i=0;i<n;i++){a[i][n/2]=cnt;cnt+=2;}
for(int i=0;i<n;i++){if(i!=n/2){a[n/2][i]=cnt;cnt+=2;}}
cnt=2;
 for(int i=0;i<n;i++)
 {
     for(int j=0;j<n;j++) {if(a[i][j]==0){a[i][j]=cnt; cnt+=2;}cout<<a[i][j]<<" ";}
             cout<<endl;
 }
 return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return a > val ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}

const int maxn = 50 + 10;
int n;
int a[maxn][maxn];

void solve() {
	cin >> n;
	int x = 2, y = 3;
	a[n >> 1][n >> 1] = 1;
	FOR(i, 0, n) FOR(j, 0, n) if (i < j) {
		if (x < n * n) {
			a[i][j] = x; x += 2;
			a[n - i - 1][n - j - 1] = x; x += 2;
		}
		else {
			a[i][j] = y; y += 2;
			a[n - i - 1][n - j - 1] = y; y += 2;
		}
	}
	FOR(i, 0, n >> 1) {
		if (x < n * n) {
			a[i][i] = x; x += 2;
			a[n - i - 1][n - i - 1] = x; x += 2;
		}
		else {
			a[i][i] = y; y += 2;
			a[n - i - 1][n - i - 1] = y; y += 2;
		}
	}
	FOR(i, 0, n) FOR(j, 0, n) cout << a[i][j] << " \n"[j == n - 1];
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return a > val ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}

const int maxn = 50;
int n;
int a[maxn][maxn];

void solve() {
	cin >> n;
	int x = 1, y = 2;
	FOR(i, 0, n) FOR(j, 0, n) if (i == n / 2 || j == n / 2) {
		a[i][j] = x, x += 2;
	}
	FOR(i, 0, n) FOR(j, 0, n) if (i < n / 2 && j != n / 2) {
		if (x < n * n) {
			a[i][j] = x, x += 2;
			a[n - i - 1][j] = x, x += 2;
		}
		else {
			a[i][j] = y, y += 2;
			a[n - i - 1][j] = y, y += 2;
		}
	}
	FOR(i, 0, n) FOR(j, 0, n) cout << a[i][j] << " \n"[j == n - 1];
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return a > val ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}

const int maxn = 50;
int n;
int a[maxn][maxn];

void solve() {
	cin >> n;
	int x = 1, y = 2;
	FOR(i, 0, n) FOR(j, 0, n) if (i == n / 2 || j == n / 2) {
		a[i][j] = x, x += 2;
	}
	FOR(i, 0, n) FOR(j, 0, n) if (i < n / 2 && j < n / 2) {
		if (x < n * n) {
			a[i][j] = x, x += 2;
			a[n - i - 1][j] = x, x += 2;
			a[i][n - j - 1] = x, x += 2;
			a[n - i - 1][n - j - 1] = x, x += 2;
		}
	}
	FOR(i, 0, n) FOR(j, 0, n) if (!a[i][j]) {
		a[i][j] = y, y += 2;
	}
	FOR(i, 0, n) FOR(j, 0, n) cout << a[i][j] << " \n"[j == n - 1];
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return a > val ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}

const int maxn = 50 + 10;
int n;

void solve() {
	cin >> n;
	int x = 2, y = 1;
	FOR(i, 0, n) FOR(j, 0, n) {
		if (i == j) {
			cout << y << " \n"[j == n - 1];
			y += 2;
		}
		else {
			cout << x << " \n"[j == n - 1];
			x += 2;
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int orig[50][50];
int output[50][50];

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			orig[i][j] = (i - 1)*n + j;

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
		{
			if (j == i && i + j < n + 1)
			{
				output[i][j] = orig[i + 1][j];
			}
			else if (j > i && i + j < n + 1)
			{
				output[i][j] = orig[i][j - 1];
			}
			else if (j > i && i + j == n + 1)
			{
				output[i][j] = orig[i][j - 1];
			}
			else if (j > i && i + j > n + 1)
			{
				output[i][j] = orig[i-1][j];
			}
			else if (j == i && i + j > n + 1)
			{
				output[i][j] = orig[i - 1][j];
			}
			else if (j<i && i + j > n + 1)
			{
				output[i][j] = orig[i][j+1];
			}
			else if (j < i && i + j == n + 1)
			{
				output[i][j] = orig[i][j + 1];
			}
			else if (j < i && i + j < n + 1)
			{
				output[i][j] = orig[i+1][j];
			}
			else
			{
				output[i][j] = orig[i][j];
			}
		}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			cout << output[i][j]<<(j==n?'\n':' ');

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int orig[50][50];
int output[50][50];

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			orig[i][j] = (i - 1)*n + j;

	if (n % 4 == 1)
	{
		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= n; j++)
			{
				cout << orig[i][j];
				if (j < n)
					cout << " ";
			}
			if (i < n)
				cout << "\n";

		}
		return 0;
	}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
		{
			if (j == i && i + j < n + 1)
			{
				output[i][j] = orig[i + 1][j];
			}
			else if (j > i && i + j < n + 1)
			{
				output[i][j] = orig[i][j - 1];
			}
			else if (j > i && i + j == n + 1)
			{
				output[i][j] = orig[i][j - 1];
			}
			else if (j > i && i + j > n + 1)
			{
				output[i][j] = orig[i-1][j];
			}
			else if (j == i && i + j > n + 1)
			{
				output[i][j] = orig[i - 1][j];
			}
			else if (j<i && i + j > n + 1)
			{
				output[i][j] = orig[i][j+1];
			}
			else if (j < i && i + j == n + 1)
			{
				output[i][j] = orig[i][j + 1];
			}
			else if (j < i && i + j < n + 1)
			{
				output[i][j] = orig[i+1][j];
			}
			else
			{
				output[i][j] = orig[i][j];
			}
		}

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << output[i][j];
			if (j < n)
				cout << " ";
		}
		if (i < n)
			cout << "\n";

	}

	return 0;
}