import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class petyaStairs {

    public static void main(String[] args) throws IOException {

        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] s=br.readLine().split(" ");

        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);

        int[] arr=new int[m];
        s=br.readLine().split(" ");
        for(int i=0;i<m;i++){
            arr[i]=Integer.parseInt(s[i]);
        }

        Arrays.sort(arr);
        int c=0;
        boolean z=false;

        if(m!=0){
            if(arr[0]==1 || arr[m-1]==n)
                z=true;
        }
        for(int i=0;i<m-1&&!z;i++){

            if(arr[i]+1==arr[i+1]){
                c++;
            }else
                c=0;
            if(c==2){
                z=true;
                break;
            }
        }
        if(z)
            System.out.println("NO");
        else
            System.out.println("YES");
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class petyaStairs {

    public static void main(String[] args) throws IOException {

        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] s=br.readLine().split(" ");

        int n=Integer.parseInt(s[0]);
        int m=Integer.parseInt(s[1]);

        int[] arr=new int[m];
        if(m!=0)
            s=br.readLine().split(" ");
        for(int i=0;i<m;i++){
            arr[i]=Integer.parseInt(s[i]);
        }

        Arrays.sort(arr);
        int c=0;
        boolean z=false;

        if(m!=0){
            if(arr[0]==1 || arr[m-1]==n)
                z=true;
        }
        for(int i=0;i<m-1&&!z;i++){

            if(arr[i]+1==arr[i+1]){
                c++;
            }else
                c=0;
            if(c==2){
                z=true;
                break;
            }
        }
        if(z)
            System.out.println("NO");
        else
            System.out.println("YES");
    }

}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Contest103 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int []a=new int[m+1];
if(m==0){
	System.out.println("YES");
	return;
}
for (int i = 1; i <=m; i++) {
	a[i]=sc.nextInt();
}

   Arrays.sort(a);
   if(a[m]==n || a[1]==1){
	   System.out.println("NO");
	   return;
   }
   for (int i = 1; i <=m-2; i++) {
	if(a[i+1]-a[i]==1 && a[i+2]-a[i+1]==1){
		System.out.printf("NO");
		return;
	}

   }

   System.out.printf("YES");

}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Contest103 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int []a=new int[m+1];
if(m==0){
	System.out.println("yes");
	return;
}
for (int i = 1; i <=m; i++) {
	a[i]=sc.nextInt();
}

   Arrays.sort(a);
   if(a[m]==n || a[1]==1){
	   System.out.println("NO");
	   return;
   }
   for (int i = 1; i <=m-2; i++) {
	if(a[i+1]-a[i]==1 && a[i+2]-a[i+1]==1){
		System.out.printf("NO");
		return;
	}

   }

   System.out.printf("YES");

}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Contest103 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int []a=new int[m+1];
for (int i = 1; i <=m; i++) {
	a[i]=sc.nextInt();
}

if(a[m]==n || a[1]==1){
System.out.printf("NO");
		return;

}

   Arrays.sort(a);
   for (int i = 1; i <=m-2; i++) {
	if(a[i+1]-a[i]==1 && a[i+2]-a[i+1]==1){
		System.out.printf("NO");
		return;
	}

   }

   System.out.printf("YES");

}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Contest103 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int []a=new int[m+1];

if(m==0){
   System.out.printf("YES");
return;
}
for (int i = 1; i <=m; i++) {
	a[i]=sc.nextInt();
}

if(a[m]==n || a[1]==1){
System.out.printf("NO");
		return;

}

   Arrays.sort(a);
   for (int i = 1; i <=m-2; i++) {
	if(a[i+1]-a[i]==1 && a[i+2]-a[i+1]==1){
		System.out.printf("NO");
		return;
	}

   }

   System.out.printf("YES");

}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Contest103 {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int []a=new int[m+1];
for (int i = 1; i <=m; i++) {
	a[i]=sc.nextInt();
}

   Arrays.sort(a);
   for (int i = 1; i <=m-2; i++) {
	if(a[i+1]-a[i]==1 && a[i+2]-a[i+1]==1){
		System.out.printf("NO");
		return;
	}

   }

   System.out.printf("YES");

}
}


package PetyaAndStaircases;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;

public class Main
{
	TreeSet<Integer> bad = new TreeSet<Integer>();
	private String tokens[];
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String ar[]) throws IOException
	{
		Main demo = new Main();
		demo.solve();
	}

	/*
	 * 10 5
	 *
	 * 2 4 8 3 6
	 */
	public void solve() throws IOException
	{
		tokens = br.readLine().split(" ");
		int total = Integer.parseInt(tokens[0]);
		int totalBad = Integer.parseInt(tokens[1]);

		tokens = br.readLine().split(" ");
		for (int i = 0; i < tokens.length; i++)
		{
			bad.add(Integer.parseInt(tokens[i]));
		}

		if (bad.contains(1) || bad.contains(total))
		{
			System.out.println("NO");
			return;
		}
		while (!bad.isEmpty())
		{
			int temp = bad.pollFirst();
			if (bad.contains(temp + 1) && bad.contains(temp + 2))
			{
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;

public class Main
{
	TreeSet<Integer> bad = new TreeSet<Integer>();
	private String tokens[];
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String ar[]) throws IOException
	{
		Main demo = new Main();
		demo.solve();
	}

	public void solve() throws IOException
	{
		tokens = br.readLine().split(" ");
		int total = Integer.parseInt(tokens[0]);
		int totalBad = Integer.parseInt(tokens[1]);
		if (totalBad > 0)
		{
			tokens = br.readLine().split(" ");
			for (int i = 0; i < tokens.length; i++)
			{
				bad.add(Integer.parseInt(tokens[i]));
			}

			if (bad.contains(1) || bad.contains(total))
			{
				System.out.println("NO");
				return;
			}
			while (!bad.isEmpty())
			{
				int temp = bad.pollFirst();
				if (bad.contains(temp + 1) && bad.contains(temp + 2))
				{
					System.out.println("NO");
					return;
				}
			}
		}
		System.out.println("YES");
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;

public class Main
{
	TreeSet<Integer> bad = new TreeSet<Integer>();
	private String tokens[];
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String ar[]) throws IOException
	{
		Main demo = new Main();
		demo.solve();
	}

	/*
	 * 10 5
	 *
	 * 2 4 8 3 6
	 */
	public void solve() throws IOException
	{
		tokens = br.readLine().split(" ");
		int total = Integer.parseInt(tokens[0]);
		int totalBad = Integer.parseInt(tokens[1]);

		tokens = br.readLine().split(" ");
		for (int i = 0; i < tokens.length; i++)
		{
			bad.add(Integer.parseInt(tokens[i]));
		}

		if (bad.contains(1) || bad.contains(total))
		{
			System.out.println("NO");
			return;
		}
		while (!bad.isEmpty())
		{
			int temp = bad.pollFirst();
			if (bad.contains(temp + 1) && bad.contains(temp + 2))
			{
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");

	}

}


import java.io.*;
import java.util.*;

public class PetyaAndStaircases {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        if (m == 0) {
            System.out.println("YES");
            return;
        }
        int[] a = new int[m];
        st = new StringTokenizer(f.readLine());
        for (int i = 0; i < m; i++)
            a[i] = Integer.parseInt(st.nextToken());
        Arrays.sort(a);
        if (a[0] == 1 || a[m-1] == n) {
            System.out.println("NO");
            return;
        }
        for (int i = 0; i < m-2; i++)
            if (a[i]+1 == a[i+1] && a[i+1]+1 == a[i+2]) {
                System.out.println("NO");
                return;
            }
        System.out.println("YES");
    }
}


import java.io.*;
import java.util.*;

public class PetyaAndStaircases {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int[] a = new int[m];
        st = new StringTokenizer(f.readLine());
        for (int i = 0; i < m; i++)
            a[i] = Integer.parseInt(st.nextToken());
        Arrays.sort(a);
        if (a[0] == 1 || a[m-1] == n) {
            System.out.println("NO");
            return;
        }
        for (int i = 0; i < m-2; i++)
            if (a[i]+1 == a[i+1] && a[i+1]+1 == a[i+2]) {
                System.out.println("NO");
                return;
            }
        System.out.println("YES");
    }
}


import java.io.*;
import java.util.*;

public class PetyaAndStaircases {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int[] a = new int[m];
        st = new StringTokenizer(f.readLine());
        for (int i = 0; i < m; i++)
            a[i] = Integer.parseInt(st.nextToken());
        Arrays.sort(a);
        if (m > 0 && (a[0] == 1 || a[m-1] == n)) {
            System.out.println("NO");
            return;
        }
        for (int i = 0; i < m-2; i++)
            if (a[i]+1 == a[i+1] && a[i+1]+1 == a[i+2]) {
                System.out.println("NO");
                return;
            }
        System.out.println("YES");
    }
}


import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;

public class Code {
	BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
	PrintWriter writer=new PrintWriter(System.out);

	int [] readInts()throws IOException{
		String s[]=reader.readLine().split(" ");
		int [] ints=new int[s.length];
		for (int i=0;i<ints.length;i++)
			ints[i]=Integer.parseInt(s[i]);
		return ints;
	}

	void solve() throws IOException{
		int [] tmp=new int [4];
		tmp=readInts();
		int n=tmp[0],m=tmp[1];
		if (m==0){
			writer.println("YES");
			writer.flush();
			return;

		}
		int [] a=readInts();
		Arrays.sort(a);
		if (a[m-1]==n||a[0]==1){
			writer.println("NO");
			writer.flush();
			return;
		}
		if (m<3){
			writer.println("YES");
			writer.flush();
			return;
		}
		for (int i=2;i<m;i++)
			if (a[i]-1==a[i-1]&&a[i-1]-1==a[i-2]){
				writer.println("NO");
				writer.flush();
				return;
			}
		writer.println("YES");
		writer.flush();
	}

	public static void main(String args[]) throws IOException{
		new Code().solve();
	}
}


import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;

public class Code {
	BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
	PrintWriter writer=new PrintWriter(System.out);

	int [] readInts()throws IOException{
		String s[]=reader.readLine().split(" ");
		int [] ints=new int[s.length];
		for (int i=0;i<ints.length;i++)
			ints[i]=Integer.parseInt(s[i]);
		return ints;
	}

	void solve() throws IOException{
		int [] tmp=new int [4];
		tmp=readInts();
		int n=tmp[0],m=tmp[1];
		int [] a=readInts();
		Arrays.sort(a);
		if (a[m-1]==n||a[0]==1){
			writer.println("NO");
			writer.flush();
			return;
		}
		if (m<3){
			writer.println("YES");
			writer.flush();
			return;
		}
		for (int i=2;i<m;i++)
			if (a[i]-1==a[i-1]&&a[i-1]-1==a[i-2]){
				writer.println("NO");
				writer.flush();
				return;
			}
		writer.println("YES");
		writer.flush();
	}

	public static void main(String args[]) throws IOException{
		new Code().solve();
	}
}


import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;

public class Code {
	BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
	PrintWriter writer=new PrintWriter(System.out);

	int [] readInts()throws IOException{
		String s[]=reader.readLine().split(" ");
		int [] ints=new int[s.length];
		for (int i=0;i<ints.length;i++)
			ints[i]=Integer.parseInt(s[i]);
		return ints;
	}

	void solve() throws IOException{
		int [] tmp=new int [4];
		tmp=readInts();
		int n=tmp[0],m=tmp[1];
		if (m<3){
			writer.println("NO");
			writer.flush();
			return;
		}
		int [] a=readInts();
		Arrays.sort(a);
		if (a[m-1]==n){
			writer.println("NO");
			writer.flush();
			return;
		}
		for (int i=2;i<m;i++)
			if (a[i]-1==a[i-1]&&a[i-1]-1==a[i-2]){
				writer.println("NO");
				writer.flush();
				return;
			}
		writer.println("YES");
		writer.flush();
	}

	public static void main(String args[]) throws IOException{
		new Code().solve();
	}
}


import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;

public class Code {
	BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
	PrintWriter writer=new PrintWriter(System.out);

	int [] readInts()throws IOException{
		String s[]=reader.readLine().split(" ");
		int [] ints=new int[s.length];
		for (int i=0;i<ints.length;i++)
			ints[i]=Integer.parseInt(s[i]);
		return ints;
	}

	void solve() throws IOException{
		int [] tmp=new int [4];
		tmp=readInts();
		int n=tmp[0],m=tmp[1];
		if (m<3){
			writer.println("NO");
			writer.flush();
			return;
		}
		int [] a=readInts();
		Arrays.sort(a);
		for (int i=2;i<m;i++)
			if (a[i]-1==a[i-1]&&a[i-1]-1==a[i-2]){
				writer.println("NO");
				writer.flush();
				return;
			}
		writer.println("YES");
		writer.flush();
	}

	public static void main(String args[]) throws IOException{
		new Code().solve();
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int[] a = new int[m];
        for (int i = 0; i < m; ++i) {
            a[i] = s.nextInt();
        }

        if(m == 0) {
            System.out.println("YES");
            System.exit(0);
        }

        Arrays.sort(a);

        if(a[0] == 1 || a[m-1] == n) {
            System.out.println("NO");
            System.exit(0);
        }

        int curCount = 0;
        for(int i=0; i<m - 1; ++i) {
            if(a[i] == a[i+1] - 1) {
                ++curCount;
            } else {
                curCount = 0;
            }

            if(curCount >= 2) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int[] a = new int[m];
        for (int i = 0; i < m; ++i) {
            a[i] = s.nextInt();
        }

        if(m == 0) {
            System.out.println("YES");
            System.exit(0);
        }

        Arrays.sort(a);

        if(a[0] == 0 || a[m-1] == n) {
            System.out.println("NO");
            System.exit(0);
        }

        int curCount = 1;
        int temp = a[0];
        for(int i=1; i<m; ++i) {
            if(a[i] - 1 == temp) {
                ++curCount;
            } else {
                curCount = 0;
            }

            temp = a[i];
            if(curCount >= 3) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int[] a = new int[m];
        for (int i = 0; i < m; ++i) {
            a[i] = s.nextInt();
        }

        if(m == 0) {
            System.out.println("YES");
            System.exit(0);
        }

        Arrays.sort(a);

        if(a[0] == 0 || a[m-1] == n) {
            System.out.println("NO");
            System.exit(0);
        }

        int curCount = 0;
        for(int i=0; i<m - 1; ++i) {
            if(a[i] == a[i+1] - 1) {
                ++curCount;
            } else {
                curCount = 0;
            }

            if(curCount >= 2) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int[] a = new int[m];
        for (int i = 0; i < m; ++i) {
            a[i] = s.nextInt();
        }
        if(m == 0) {
            System.out.println("NO");
            System.exit(0);
        }

        Arrays.sort(a);

        if(a[0] == 0 || a[m-1] == n) {
            System.out.println("NO");
            System.exit(0);
        }

        int curCount = 1;
        int temp = a[0];
        for(int i=1; i<m; ++i) {
            if(a[i] - 1 == temp) {
                ++curCount;
            } else {
                curCount = 0;
            }

            temp = a[i];
            if(curCount >= 3) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int[] a = new int[m];
        for (int i = 0; i < m; ++i) {
            a[i] = s.nextInt();
        }

        if(m == 0) {
            System.out.println("YES");
            System.exit(0);
        }

        Arrays.sort(a);
        System.out.println(Arrays.toString(a));

        if(a[0] == 0 || a[m-1] == n) {
            System.out.println("NO");
            System.exit(0);
        }

        int curCount = 0;
        for(int i=0; i<m - 1; ++i) {
            if(a[i] == a[i+1] - 1) {
                ++curCount;
            } else {
                curCount = 0;
            }

            if(curCount >= 2) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        int[] a = new int[m];
        for (int i = 0; i < m; ++i) {
            a[i] = s.nextInt();
        }

        Arrays.sort(a);

        if(a[0] == 0 || a[m-1] == n) {
            System.out.println("NO");
            System.exit(0);
        }

        int curCount = 1;
        int temp = a[0];
        for(int i=1; i<m; ++i) {
            if(a[i] - 1 == temp) {
                ++curCount;
            } else {
                curCount = 0;
            }

            temp = a[i];
            if(curCount >= 3) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}


import java.util.*;

public class Solution22 {
    public static ArrayList<Integer> a = new ArrayList<Integer>();

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            int curr = scanner.nextInt();
            if (curr == 1 || curr == n) {
                System.out.println("NO");
                return;
            }
            a.add(curr);
        }
        Collections.sort(a);
        for (int i = 2; i < m; i++) {
            if (a.get(i) - a.get(i - 1) == 1 && a.get(i - 1) - a.get(i - 2) == 1) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}


import java.util.*;

public class Solution {
    public static ArrayList<Integer> a = new ArrayList<Integer>();

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            a.add(scanner.nextInt());
        }
        Collections.sort(a);
        int c = 0;
        for (int i = 1; i <= n; ) {
            if (c == i) {
                System.out.println("NO");
                return;
            }
            c = i;
            if (i == n) break;
            if (i + 3 <= n && !contains(i + 3)) i += 3;
            else if (i + 2 <= n && !contains(i + 2)) i += 2;
            else if (i + 1 <= n && !contains(i + 1)) i += 1;
        }
        System.out.println("YES");
    }

    public static boolean contains(int x) {
        int l = 0, r = a.size() - 1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (x >= a.get(mid)) {
                l = mid;
            } else {
                r = mid;
            }
            if (r - l <= 1) break;
        }
        return a.get(l) == x || a.get(r) == x;
    }
}


import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        boolean[] a = new boolean[n + 1];
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            a[scanner.nextInt()] = true;
        }
        int c = 0;
        for (int i = 1; i <= n; ) {
            if (c == i) {
                System.out.println("NO");
                return;
            }
            c = i;
            if (i == n) break;
            if (i + 3 <= n && !a[i + 3]) i += 3;
            if (i + 2 <= n && !a[i + 2]) i += 2;
            if (i + 1 <= n && !a[i + 1]) i += 1;
        }
        System.out.println("YES");
    }
}


import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            a.add(scanner.nextInt());
        }
        Collections.sort(a);
        int c = 0;
        for (int i = 1; i <= n; ) {
            if (c == i) {
                System.out.println("NO");
                return;
            }
            c = i;
            if (i == n) break;
            if (i + 3 <= n && !a.contains(i + 3)) i += 3;
            else if (i + 2 <= n && !a.contains(i + 2)) i += 2;
           else if (i + 1 <= n && !a.contains(i + 1)) i += 1;
        }
        System.out.println("YES");
    }
}


import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
       /* int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            char[][] doska = new char[8][8];
            for (int j = 0; j < 8; j++) {
                doska[j] = scanner.nextLine().toCharArray();
            }

            int i1, j1, i2, j2, counter = 0;
            for (int z1 = 0; z1 < 8; z1++)
                for (int z2 = 0; z2 < 8; z2++)
                    if (doska[z1][z2] == 'K' && counter == 0) {
                        counter++;
                        i1 = z1;
                        j1 = z2;
                    } else {
                        i2 = z1;
                        j2 = z2;
                    }
            if (Math.max(i1-)

        }   */
        int n = scanner.nextInt();
        boolean[] a = new boolean[n + 1];
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            int curr = scanner.nextInt();
            if (curr == 1 || curr == n) {
                System.out.println("NO");
                return;
            }
            a[curr] = true;
        }
        boolean maker = true;
        int c = 0;
        for (int i = 1; i <= n; ) {
            if (c == i) {
                System.out.println("NO");
                return;
            }
            c = i;
            if (i == n) break;
            if (i + 3 <= n && !a[i + 3]) i += 3;
            if (i + 2 <= n && !a[i + 2]) i += 2;
            if (i + 1 <= n && !a[i + 1]) i += 1;
        }
        System.out.println("YES");
    }
}


import java.util.*;

public class Solution {
    public static ArrayList<Integer> a = new ArrayList<Integer>();
    public static int n;
    public static int[] d;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
       /* int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            char[][] doska = new char[8][8];
            for (int j = 0; j < 8; j++) {
                doska[j] = scanner.nextLine().toCharArray();
            }

            int i1, j1, i2, j2, counter = 0;
            for (int z1 = 0; z1 < 8; z1++)
                for (int z2 = 0; z2 < 8; z2++)
                    if (doska[z1][z2] == 'K' && counter == 0) {
                        counter++;
                        i1 = z1;
                        j1 = z2;
                    } else {
                        i2 = z1;
                        j2 = z2;
                    }
            if (Math.max(i1-)

        }   */
        n = scanner.nextInt();
        int m = scanner.nextInt();
        d = new int[n + 1];
        for (int i = 0; i < m; i++) {
            int curr = scanner.nextInt();
            if (curr == 1 || curr == n) {
                System.out.println("NO");
                return;
            }
            a.add(curr);
        }
        if (!f(1)) System.out.println("NO");
        else System.out.println("YES");
    }

    public static boolean f(int k) {
        if (d[k] != 0) return d[k] == 1;
        if (a.contains(k)) return false;
        if (k == n) return true;
        if (k + 1 <= n) {
            if (f(k + 1)) {
                d[k + 1] = 1;
                return true;
            } else d[k + 1] = -1;
        }
        if (k + 2 <= n) {
            if (f(k + 2)) {
                d[k + 2] = 1;
                return true;
            } else d[k + 2] = -1;
        }
        if (k + 3 <= n) {
            if (f(k + 3)) {
                d[k + 3] = 1;
                return true;
            } else d[k + 3] = -1;
        }
        d[k] = -1;
        return false;
    }
}


import java.util.*;

public class Solution22 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            a.add(scanner.nextInt());
        }
        int c = 0;
        for (int i = 1; i <= n; ) {
            if (c == i) {
                System.out.println("NO");
                return;
            }
            c = i;
            if (i == n) break;
            if (i + 3 <= n && !a.contains(i + 3)) i += 3;
            else if (i + 2 <= n && !a.contains(i + 2)) i += 2;
           else if (i + 1 <= n && !a.contains(i + 1)) i += 1;
        }
        System.out.println("YES");
    }
}


import java.util.*;

public class Solution {
    public static ArrayList<Integer> a = new ArrayList<Integer>();
    public static int n;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
       /* int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            char[][] doska = new char[8][8];
            for (int j = 0; j < 8; j++) {
                doska[j] = scanner.nextLine().toCharArray();
            }

            int i1, j1, i2, j2, counter = 0;
            for (int z1 = 0; z1 < 8; z1++)
                for (int z2 = 0; z2 < 8; z2++)
                    if (doska[z1][z2] == 'K' && counter == 0) {
                        counter++;
                        i1 = z1;
                        j1 = z2;
                    } else {
                        i2 = z1;
                        j2 = z2;
                    }
            if (Math.max(i1-)

        }   */
        n = scanner.nextInt();
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            int curr = scanner.nextInt();
            if (curr == 1 || curr == n) {
                System.out.println("NO");
                return;
            }
            a.add(curr);
        }
        if (!f(1)) System.out.println("NO");
        else System.out.println("YES");
    }

    public static boolean f(int k) {
        if (a.contains(k)) return false;
        if (k == n) return true;
        if (k + 1 <= n) {
            if (f(k + 1)) return true;
        }
        if (k + 2 <= n) {
            if (f(k + 2)) return true;
        }
        if (k + 3 <= n) {
            if (f(k + 3)) return true;
        }
        return false;
    }
}


import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        ArrayList<Integer> a = new ArrayList<Integer>();
        int m = scanner.nextInt();
        for (int i = 0; i < m; i++) {
            a.add(scanner.nextInt());
        }
        int c = 0;
        for (int i = 1; i <= n; ) {
            if (c == i) {
                System.out.println("NO");
                return;
            }
            c = i;
            if (i == n) break;
            if (i + 3 <= n && !a.contains(i + 3)) i += 3;
            if (i + 2 <= n && !a.contains(i + 2)) i += 2;
            if (i + 1 <= n && !a.contains(i + 1)) i += 1;
        }
        System.out.println("YES");
    }
}


import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
import java.awt.geom.*;
public class PetyaandStairs {
    public static int check(boolean a[],int i)
    {
        if(i>=a.length || a[i]==true)
            return -1;
        else if(i==a.length-1 && a[i]==false)
            return 2;
        else
            return Math.max(check(a,i+1),Math.max(check(a,i+2),check(a,i+3)));
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int a[]=new int[m];
        for(int i=0;i<m;i++)
            a[i]=sc.nextInt();
        Arrays.sort(a);
        if(a[0]==1 || a[m-1]==n)
            System.out.println("NO");
        else
        {
            int count=0;
            for(int i=1;i<m;i++)
            {
                if(a[i]-a[i-1]==1)
                    count++;
                else
                    count=0;
                if(count==2)
                    break;
            }
            if(count==2)
                System.out.println("NO");
            else
                System.out.println("YES");
        }
    }

}


import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
import java.awt.geom.*;
public class PetyaandStairs {
    public static int check(boolean a[],int i)
    {
        if(i>=a.length || a[i]==true)
            return -1;
        else if(i==a.length-1 && a[i]==false)
            return 2;
        else
            return Math.max(check(a,i+1),Math.max(check(a,i+2),check(a,i+3)));
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        boolean a[]=new boolean[n];
        for(int i=0;i<m;i++)
            a[sc.nextInt()-1]=true;
       // for(int i=0;i<n;i++)
            //System.out.print(a[i]+" ");
        int c=check(a,0);
        if(c==2)
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
import java.awt.geom.*;
public class PetyaandStairs {
    public static int check(int a[],int i)
    {
        if(i>=a.length || a[i]==1)
            return -1;
        else if(i==a.length-1 && a[i]==0)
            return 2;
        else
            return Math.max(check(a,i+1),Math.max(check(a,i+2),check(a,i+3)));
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<m;i++)
            a[sc.nextInt()-1]=1;
        int c=check(a,0);
        if(c==2)
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}


import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
import java.awt.geom.*;
public class PetyaandStairs {
    public static int check(boolean a[],int i)
    {
        if(i>=a.length || a[i]==true)
            return -1;
        else if(i==a.length-1 && a[i]==false)
            return 2;
        else
            return Math.max(check(a,i+1),Math.max(check(a,i+2),check(a,i+3)));
    }
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m!=0)
        {
        int a[]=new int[m];
        for(int i=0;i<m;i++)
            a[i]=sc.nextInt();
        Arrays.sort(a);
        if(a[0]==1 || a[m-1]==n)
            System.out.println("NO");
        else
        {
            int count=0;
            for(int i=1;i<m;i++)
            {
                if(a[i]-a[i-1]==1)
                    count++;
                else
                    count=0;
                if(count==2)
                    break;
            }
            if(count==2)
                System.out.println("NO");
            else
                System.out.println("YES");
        }
       }
        else
            System.out.println("YES");
    }

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Queue;

public class Main {
    final int maxn = 1 << 11;
    Scanner in;
    PrintWriter out;

    public void Run() throws IOException {
        if (new File("input.txt").exists()) {
            in = new Scanner(new FileInputStream(new File("input.txt")));
            out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        } else {
            in = new Scanner(System.in);
            out = new PrintWriter(System.out);
        }

        int n = in.nextInt(), m = in.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);

        boolean ok = true;
        ok &= a[0] != 1;
        ok &= a[m - 1] != n;

        int cur = 1;
        for (int i = 0; i < n; i++) {
            if (a[i] < cur) continue;
            if (a[i] > cur) cur = a[i] - 1;
            if (i + 1 >= n || a[i + 1] != a[i] + 1) {
                cur = a[i] + 1;
                continue;
            }
            if (i + 2 >= n || a[i + 2] != a[i] + 2) {
                cur = a[i] + 2;
                continue;
            }
            ok = false;
        }
        if (ok) out.println("NO");
        else out.println("YES");

        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().Run();
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Queue;

public class Main {
    final int maxn = 1 << 11;
    Scanner in;
    PrintWriter out;

    public void Run() throws IOException {
        if (new File("input.txt").exists()) {
            in = new Scanner(new FileInputStream(new File("input.txt")));
            out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        } else {
            in = new Scanner(System.in);
            out = new PrintWriter(System.out);
        }

        int n = in.nextInt(), m = in.nextInt();
        int a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);

        boolean ok = true;
        if (m >= 1) {
            ok &= a[0] != 1;
            ok &= a[m - 1] != n;
        }
        int cur = 1;
        for (int i = 0; i < m; i++) {
            if (a[i] < cur) continue;
            if (a[i] > cur) cur = a[i] - 1;
            if (i + 1 >= m || a[i + 1] != a[i] + 1) {
                cur = a[i] + 1;
                continue;
            }
            if (i + 2 >= m || a[i + 2] != a[i] + 2) {
                cur = a[i] + 2;
                continue;
            }
            ok = false;
        }
        if (!ok) out.println("NO");
        else out.println("YES");

        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().Run();
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Queue;

public class Main {
    final int maxn = 1 << 11;
    Scanner in;
    PrintWriter out;

    public void Run() throws IOException {
        if (new File("input.txt").exists()) {
            in = new Scanner(new FileInputStream(new File("input.txt")));
            out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        } else {
            in = new Scanner(System.in);
            out = new PrintWriter(System.out);
        }

        int n = in.nextInt(), m = in.nextInt();
        int a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);

        boolean ok = true;
        ok &= a[0] != 1;
        ok &= a[m - 1] != n;

        int cur = 1;
        for (int i = 0; i < m; i++) {
            if (a[i] < cur) continue;
            if (a[i] > cur) cur = a[i] - 1;
            if (i + 1 >= m || a[i + 1] != a[i] + 1) {
                cur = a[i] + 1;
                continue;
            }
            if (i + 2 >= m || a[i + 2] != a[i] + 2) {
                cur = a[i] + 2;
                continue;
            }
            ok = false;
        }
        if (!ok) out.println("NO");
        else out.println("YES");

        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().Run();
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
import java.math.*;
import java.io.*;

/**
 *
 * @author magzhankairanbay
 */
public class Code {

    public static boolean check(int[] a, int n) {
        for (int i = 0; i < n; i++) {
            if (a[i] != 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        try {

            Scanner in = new Scanner(System.in);

            int n = in.nextInt();
            int m = in.nextInt();

            int[] a = new int[m];
            int[] b = new int[m - 1];

            for (int i = 0; i < m; i++) {
                a[i] = in.nextInt();
            }

            for (int i = 0; i < m; i++) {
                if (a[i] == 1 || a[i] == n) {
                    System.out.println("NO");
                    return;
                }
            }

            int c = 0;

            Arrays.sort(a);
            for (int i = 1; i < m; i++) {
                b[i - 1] = a[i] - a[i - 1];
                if (b[i - 1] == 1) {
                    c++;
                    if (c >= 2) {
                        System.out.println("NO");
                        return;
                    }
                } else {
                    c = 0;
                }
            }

            if (c >= 2) {
                System.out.println("NO");
                return;
            }

            System.out.println("YES");

        } catch(Exception ex) {

            System.out.println(ex.toString());
        }
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
import java.math.*;
import java.io.*;

/**
 *
 * @author magzhankairanbay
 */
public class Code {

    public static boolean check(int[] a, int n) {
        for (int i = 0; i < n; i++) {
            if (a[i] != 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        try {

            Scanner in = new Scanner(System.in);

            int n = in.nextInt();
            int m = in.nextInt();

            if (m == 0) {
                System.out.println("YES");
                return;
            }

            int[] a = new int[m];
            int[] b = new int[m - 1];

            for (int i = 0; i < m; i++) {
                a[i] = in.nextInt();
            }

            for (int i = 0; i < m; i++) {
                if (a[i] == 1 || a[i] == n) {
                    System.out.println("NO");
                    return;
                }
            }

            int c = 0;

            Arrays.sort(a);
            for (int i = 1; i < m; i++) {
                b[i - 1] = a[i] - a[i - 1];
                if (b[i - 1] == 1) {
                    c++;
                    if (c >= 2) {
                        System.out.println("NO");
                        return;
                    }
                } else {
                    c = 0;
                }
            }

            if (c >= 2) {
                System.out.println("NO");
                return;
            }

            System.out.println("YES");

        } catch(Exception ex) {

            System.out.println(ex.toString());
        }
    }

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
import java.math.*;
import java.io.*;

/**
 *
 * @author magzhankairanbay
 */
public class Code {

    public static boolean check(int[] a, int n) {
        for (int i = 0; i < n; i++) {
            if (a[i] != 0) {
                return false;
            }
        }
        return true;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        try {

            Scanner in = new Scanner(System.in);

            int n = in.nextInt();
            int m = in.nextInt();

            int[] a = new int[m];
            int[] b = new int[m - 1];

            for (int i = 0; i < m; i++) {
                a[i] = in.nextInt();
            }

            int c = 0;

            Arrays.sort(a);
            for (int i = 1; i < m; i++) {
                b[i - 1] = a[i] - a[i - 1];
                if (b[i - 1] == 1) {
                    c++;
                    if (c >= 2) {
                        System.out.println("NO");
                        return;
                    }
                } else {
                    c = 0;
                }
            }

            System.out.println("YES");

        } catch(Exception ex) {

            System.out.println(ex.toString());
        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m;
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.valueOf(st.nextToken());
		m = Integer.valueOf(st.nextToken());

		if(m>0)
		{
			TreeSet<Integer> bs = new TreeSet<>();

			st = new StringTokenizer(br.readLine());

			boolean flag = true;
			while(st.hasMoreTokens())
			{
				int step = Integer.valueOf(st.nextToken());
				if(step == 1){
					System.out.println("NO");
					flag = false;
					break;
				}
				if(step == (n)){
					System.out.println("NO");
					flag = false;
					break;
				}
				else{
					bs.add(step);
				}
			}

			if( flag && bs.size()>=3){
				int [] a = new int[m];
				int pos = 0;
				for (Iterator<Integer> iterator = bs.iterator(); iterator.hasNext();) {
					a[pos] = iterator.next();
					if( pos > 1 ){
						if(a[pos - 1] == a[pos] - 1){
							if(a[pos - 2] == a[pos] - 2){
								flag = false;
								System.out.println("NO");
								break;
							}
						}

					}
					pos++;
				}
			}
			if(flag)
				System.out.println("YES");

		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m;
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.valueOf(st.nextToken());
		m = Integer.valueOf(st.nextToken());

		if(m>0)
		{
			TreeSet<Integer> bs = new TreeSet<>();

			st = new StringTokenizer(br.readLine());

			boolean flag = true;
			while(st.hasMoreTokens())
			{
				int step = Integer.valueOf(st.nextToken());
				if(step == 1){
					System.out.println("NO");
					flag = false;
					break;
				}
				if(step == (n)){
					System.out.println("NO");
					flag = false;
					break;
				}
				else{
					bs.add(step);
				}
			}

			if( flag && bs.size()>=3){
				int [] a = new int[m];
				int pos = 0;
				for (Iterator<Integer> iterator = bs.iterator(); iterator.hasNext();) {
					a[pos] = iterator.next();
					if( pos > 1 ){
						if(a[pos - 1] == a[pos] - 1){
							if(a[pos - 2] == a[pos] - 2){
								flag = false;
								System.out.println("NO");
								break;
							}
						}

					}
					pos++;
				}
			}
			if(flag)
				System.out.println("YES");

		}
		else{
			System.out.println("YES");
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m;
//		boolean[] s;
//		String line;
		StringTokenizer st = new StringTokenizer(br.readLine());
//		while(st.hasMoreTokens())
		{
			n = Integer.valueOf(st.nextToken());
			m = Integer.valueOf(st.nextToken());
//			s = new boolean[n];
//			int [] bs = new int[m];

			if(m>0)
			{
				TreeSet<Integer> bs = new TreeSet<>();

				st = new StringTokenizer(br.readLine());

	//			int pos = 0;
				boolean flag = true;
				while(st.hasMoreTokens())
				{
	//				s[Integer.valueOf(st.nextToken())] = false;
	//				bs[pos] = Integer.valueOf(st.nextToken());
					int step = Integer.valueOf(st.nextToken());
					if(step == 1){
						System.out.println("NO");
						flag = false;
						break;
					}
					if(step == (n)){
						System.out.println("NO");
						flag = false;
						break;
					}
					else{
						bs.add(step);
					}
	//				pos++;
				}

				if( flag && bs.size()>=3){
					int [] a = new int[m];
					int pos = 0;
					for (Iterator<Integer> iterator = bs.iterator(); iterator.hasNext();) {
						a[pos] = iterator.next();
						if( pos > 1 ){
							if(a[pos - 1] == a[pos] - 1){
								if(a[pos - 2] == a[pos] - 2){
									flag = false;
									System.out.println("NO");
									break;
								}
							}

						}
						pos++;
					}
				}
				if(flag)
					System.out.println("YES");

	//			Arrays.sort(bs);
	//			if( !s[0] )
	//				System.out.println("NO");
	//			if( !s[n-1] )
	//				System.out.println("NO");
	//			else
	//			{
	//				int flag = 0;
	//				for( int i = 1 ; i < n-1 ; i++ )
	//				{
	//					if( !s[i] )
	//					{
	//						flag++;
	//						if(flag == 3)
	//						{
	//							System.out.println("NO");
	//							break;
	//						}
	//					}
	//				}
	//			}
			}
//			st = new StringTokenizer(br.readLine());
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m;
//		boolean[] s;
//		String line;
		StringTokenizer st = new StringTokenizer(br.readLine());
		while(st.hasMoreTokens())
		{
			n = Integer.valueOf(st.nextToken());
			m = Integer.valueOf(st.nextToken());
//			s = new boolean[n];
//			int [] bs = new int[m];
			TreeSet<Integer> bs = new TreeSet<>();

			st = new StringTokenizer(br.readLine());

//			int pos = 0;
			boolean flag = true;
			while(st.hasMoreTokens())
			{
//				s[Integer.valueOf(st.nextToken())] = false;
//				bs[pos] = Integer.valueOf(st.nextToken());
				int step = Integer.valueOf(st.nextToken());
				if(step == 1){
					System.out.println("NO");
					flag = false;
					break;
				}
				if(step == (n)){
					System.out.println("NO");
					flag = false;
					break;
				}
				else{
					bs.add(step);
				}
//				pos++;
			}

			if( flag && bs.size()>=3){
				int [] a = new int[m];
				int pos = 0;
				for (Iterator<Integer> iterator = bs.iterator(); iterator.hasNext();) {
					a[pos] = iterator.next();
					if( pos > 1 ){
						if(a[pos - 1] == a[pos] - 1){
							if(a[pos - 2] == a[pos] - 2){
								flag = false;
								System.out.println("NO");
								break;
							}
						}

					}
					pos++;
				}
			}
			if(flag)
				System.out.println("YES");

//			Arrays.sort(bs);
//			if( !s[0] )
//				System.out.println("NO");
//			if( !s[n-1] )
//				System.out.println("NO");
//			else
//			{
//				int flag = 0;
//				for( int i = 1 ; i < n-1 ; i++ )
//				{
//					if( !s[i] )
//					{
//						flag++;
//						if(flag == 3)
//						{
//							System.out.println("NO");
//							break;
//						}
//					}
//				}
//			}

			st = new StringTokenizer(br.readLine());
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m;
		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.valueOf(st.nextToken());
		m = Integer.valueOf(st.nextToken());

		if(m>0)
		{
			TreeSet<Integer> bs = new TreeSet<>();

			st = new StringTokenizer(br.readLine());

			boolean flag = true;
			while(st.hasMoreTokens())
			{
				int step = Integer.valueOf(st.nextToken());
				if(step == 1){
					System.out.println("NO");
					flag = false;
					break;
				}
				if(step == (n)){
					System.out.println("NO");
					flag = false;
					break;
				}
				else{
					bs.add(step);
				}
			}

			if( flag && bs.size()>=3){
				int [] a = new int[m];
				int pos = 0;
				for (Iterator<Integer> iterator = bs.iterator(); iterator.hasNext();) {
					a[pos] = iterator.next();
					if( pos > 1 ){
						if(a[pos - 1] == a[pos] - 1){
							if(a[pos - 2] == a[pos] - 2){
								flag = false;
								System.out.println("NO");
								break;
							}
						}

					}
					pos++;
				}
			}
			if(flag)
				System.out.println("YES");

		}
		else{
			System.out.println("NO");
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n, m;
//		boolean[] s;
//		String line;
		StringTokenizer st = new StringTokenizer(br.readLine());
//		while(st.hasMoreTokens())
		{
			n = Integer.valueOf(st.nextToken());
			m = Integer.valueOf(st.nextToken());
//			s = new boolean[n];
//			int [] bs = new int[m];
			TreeSet<Integer> bs = new TreeSet<>();

			st = new StringTokenizer(br.readLine());

//			int pos = 0;
			boolean flag = true;
			while(st.hasMoreTokens())
			{
//				s[Integer.valueOf(st.nextToken())] = false;
//				bs[pos] = Integer.valueOf(st.nextToken());
				int step = Integer.valueOf(st.nextToken());
				if(step == 1){
					System.out.println("NO");
					flag = false;
					break;
				}
				if(step == (n)){
					System.out.println("NO");
					flag = false;
					break;
				}
				else{
					bs.add(step);
				}
//				pos++;
			}

			if( flag && bs.size()>=3){
				int [] a = new int[m];
				int pos = 0;
				for (Iterator<Integer> iterator = bs.iterator(); iterator.hasNext();) {
					a[pos] = iterator.next();
					if( pos > 1 ){
						if(a[pos - 1] == a[pos] - 1){
							if(a[pos - 2] == a[pos] - 2){
								flag = false;
								System.out.println("NO");
								break;
							}
						}

					}
					pos++;
				}
			}
			if(flag)
				System.out.println("YES");

//			Arrays.sort(bs);
//			if( !s[0] )
//				System.out.println("NO");
//			if( !s[n-1] )
//				System.out.println("NO");
//			else
//			{
//				int flag = 0;
//				for( int i = 1 ; i < n-1 ; i++ )
//				{
//					if( !s[i] )
//					{
//						flag++;
//						if(flag == 3)
//						{
//							System.out.println("NO");
//							break;
//						}
//					}
//				}
//			}

//			st = new StringTokenizer(br.readLine());
		}

	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class B {

	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static boolean[] dirty;

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		int n = nextInt();
		int k = nextInt();
		dirty = new boolean[n + 1];
		for (int i = 1; i <= k; i++) {
			dirty[nextInt()] = true;
		}
		ArrayList<Integer> list = new ArrayList<>();
		list.add(1);
		while (!list.isEmpty()) {
			int x = list.get(0);
			if (x == n) {
				out.print("YES");
				out.close();
				return;
			}
			for (int i = 1; i <= 3; i++) {
				if (x + i <= n && !dirty[x + i]) {
					list.add(x + i);
				}
			}
			list.remove(0);
		}
		out.print("NO");
		out.close();
	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		int n = nextInt();
		int k = nextInt();
		int[] dirty = new int[k + 1];
		for (int i = 1; i <= k; i++) {
			dirty[i] = nextInt();
			if (dirty[i] == n) {
				out.print("NO");
				out.close();
				return;
			}
		}
		Arrays.sort(dirty, 1, k + 1);
		for (int i = 1; i + 2 <= k; i++) {
			if (dirty[i + 2] == dirty[i + 1] + 1
					&& dirty[i + 1] == dirty[i] + 1) {
				out.print("NO");
				out.close();
				return;
			}
		}
		out.print("YES");
		out.close();
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static boolean[] dirty;

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		int n = nextInt();
		int k = nextInt();
		dirty = new boolean[n + 1];
		for (int i = 1; i <= k; i++) {
			dirty[nextInt()] = true;
		}
		can(n);
		out.print("NO");
		out.close();
	}

	private static void can(int x) {
		if (x == 1) {
			out.println("YES");
			out.close();
			return;
		}
		for (int i = 1; i <= 3; i++) {
			if (x - i >= 1 && !dirty[x - i]) {
				can(x - i);
			}
		}
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	static BufferedReader in;
	static StringTokenizer st;
	static PrintWriter out;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		int n = nextInt();
		int k = nextInt();
		int[] dirty = new int[k + 1];
		for (int i = 1; i <= k; i++) {
			dirty[i] = nextInt();
			if (dirty[i] == n || dirty[i] == 1) {
				out.print("NO");
				out.close();
				return;
			}
		}
		Arrays.sort(dirty, 1, k + 1);
		for (int i = 1; i + 2 <= k; i++) {
			if (dirty[i + 2] == dirty[i + 1] + 1
					&& dirty[i + 1] == dirty[i] + 1) {
				out.print("NO");
				out.close();
				return;
			}
		}
		out.print("YES");
		out.close();
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static final InputStreamReader standardInput = new InputStreamReader(System.in);
    private static final BufferedReader bufferedReader = new BufferedReader(standardInput);
    private static final Scanner scanner = new Scanner(bufferedReader);

    private static final OutputStreamWriter standardOutput = new OutputStreamWriter(System.out);
    private static final BufferedWriter bufferedWriter = new BufferedWriter(standardOutput);
    private static final PrintWriter printWriter = new PrintWriter(bufferedWriter);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] d = new int[m];
        for (int i = 0; i < m; i++) {
            d[i] = scanner.nextInt();
        }

        if (canClimbStairs(n, m, d)) {
            printWriter.println("YES");
        } else {
            printWriter.println("NO");
        }

        printWriter.flush();
        scanner.close();
    }

    private static boolean canClimbStairs(int n, int m, int[] d) {
        if(m <= 0) {
            return true;
        }
        Arrays.sort(d);
        // System.out.println(Arrays.toString(d));

        if (d[0] == 1 || d[m - 1] == n) {
            return false;
        }

        int currStair = 1;
        for (int i = 0; i < m - 2; i++) {
            // Travel Quickly
            if (currStair < d[i] - 1) {
                // System.out.println("fast travel");
                currStair = d[i] - 1;
            }

            if (currStair + 1 != d[i]) {
                // System.out.println("Jumping 1: " + currStair + " " + d[i]);
                currStair += 1;
                continue;
            } else if (currStair + 2 != d[i + 1]) {
                // System.out.println("Jumping 2: " + currStair + " " + d[i]);
                currStair += 2;
                continue;
            } else if (currStair + 3 != d[i + 1] && currStair + 3 != d[i + 2]) {
                // System.out.println("Jumping 2: " + currStair + " " + d[i]);
                currStair += 3;
                continue;
            } else {
                return false;
            }
        }

        return true;
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    private static final InputStreamReader standardInput = new InputStreamReader(System.in);
    private static final BufferedReader bufferedReader = new BufferedReader(standardInput);
    private static final Scanner scanner = new Scanner(bufferedReader);

    private static final OutputStreamWriter standardOutput = new OutputStreamWriter(System.out);
    private static final BufferedWriter bufferedWriter = new BufferedWriter(standardOutput);
    private static final PrintWriter printWriter = new PrintWriter(bufferedWriter);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] d = new int[m];
        for (int i = 0; i < m; i++) {
            d[i] = scanner.nextInt();
        }

        if (canClimbStairs(n, m, d)) {
            printWriter.println("YES");
        } else {
            printWriter.println("NO");
        }

        printWriter.flush();
        scanner.close();
    }

    private static boolean canClimbStairs(int n, int m, int[] d) {
        Arrays.sort(d);
        // System.out.println(Arrays.toString(d));

        if (d[0] == 1 || d[m - 1] == n) {
            return false;
        }

        int currStair = 1;
        for (int i = 0; i < m - 2; i++) {
            // Travel Quickly
            if (currStair < d[i] - 1) {
                // System.out.println("fast travel");
                currStair = d[i] - 1;
            }

            if (currStair + 1 != d[i]) {
                // System.out.println("Jumping 1: " + currStair + " " + d[i]);
                currStair += 1;
                continue;
            } else if (currStair + 2 != d[i + 1]) {
                // System.out.println("Jumping 2: " + currStair + " " + d[i]);
                currStair += 2;
                continue;
            } else if (currStair + 3 != d[i + 1] && currStair + 3 != d[i + 2]) {
                // System.out.println("Jumping 2: " + currStair + " " + d[i]);
                currStair += 3;
                continue;
            } else {
                return false;
            }
        }

        return true;
    }
}


import java.util.*;
public class Main{
public static void main(String... args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
if (m==0){
  System.out.println("YES");
  System.exit(0);
}
int[] t = new int[m];
for (int i=0; i<m; i++) t[i]=sc.nextInt();
Arrays.sort(t);
if (t[0]==1 || t[m-1]==n){
  System.out.println("NO");
  System.exit(0);
}
for (int i=0; i<m-2; i++){
  if (t[i]+1==t[i+1] && t[i]+2==t[i+2]){
    System.out.println("NO");
    System.exit(0);
  }
}
System.out.println("YES");

}
}


import java.util.*;
public class Main{
public static void main(String... args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] t = new int[m];
for (int i=0; i<m; i++) t[i]=sc.nextInt();
Arrays.sort(t);
if (t[0]==1 || t[m-1]==n){
  System.out.println("NO");
  System.exit(0);
}
for (int i=0; i<m-2; i++){
  if (t[i]+1==t[i+1] && t[i]+2==t[i+2]){
    System.out.println("NO");
    System.exit(0);
  }
}
System.out.println("YES");

}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class CodeForces {

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int n = Reader.nextInt(), m = Reader.nextInt();
        int arr[] = new int[m];

        for(int i = 0; i < m; i++)
            arr[i] = Reader.nextInt();

        Arrays.sort(arr);

        if(m == 0 || arr[0] == 1 || arr[m-1] == n){
            System.out.println("NO");
            return;
        }

        int c = 0;
        for(int i = 0; i < m - 1; i++){
            if(c >= 2){
                System.out.println("NO");
                return;
            }

            if(arr[i+1] - arr[i] <= 1)
                c++;
            else
                c = 0;
        }
        System.out.println("YES");
    }

    }

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class CodeForces {

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int n = Reader.nextInt(), m = Reader.nextInt();
        int arr[] = new int[m];

        for(int i = 0; i < m; i++)
            arr[i] = Reader.nextInt();

        Arrays.sort(arr);

        if(arr[0] == 1 || arr[m-1] == n){
            System.out.println("NO");
            return;
        }

        int c = 0;
        for(int i = 0; i < m - 1; i++){
            if(c >= 2){
                System.out.println("NO");
                return;
            }

            if(arr[i+1] - arr[i] <= 1)
                c++;
            else
                c = 0;
        }
        System.out.println("YES");
    }

    }

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class CodeForces {

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int n = Reader.nextInt(), m = Reader.nextInt();

        if(m == 0){
            System.out.println("YES");
            return;
        }

        int arr[] = new int[m];

        for(int i = 0; i < m; i++)
            arr[i] = Reader.nextInt();

        Arrays.sort(arr);

        if( arr[0] == 1 || arr[m-1] == n){
            System.out.println("NO");
            return;
        }

        int c = 0;
        for(int i = 0; i < m - 1; i++){
            if(c >= 2){
                System.out.println("NO");
                return;
            }

            if(arr[i+1] - arr[i] <= 1)
                c++;
            else
                c = 0;
        }
        System.out.println("YES");
    }

    }

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class CodeForces {

    public static void main(String[] args) throws IOException{
        Reader.init(System.in);
        int n = Reader.nextInt(), m = Reader.nextInt();

        if(m == 0){
            System.out.println("YES");
            return;
        }

        int arr[] = new int[m];

        for(int i = 0; i < m; i++)
            arr[i] = Reader.nextInt();

        Arrays.sort(arr);

        if( arr[0] == 1 || arr[m-1] == n){
            System.out.println("NO");
            return;
        }

        int c = 0;
        for(int i = 0; i < m - 1; i++){
            if(c >= 2){
                System.out.println("NO");
                return;
            }

            if(arr[i+1] - arr[i] <= 1)
                c++;
            else
                c = 0;
        }
        if(c >= 2 )
        System.out.println("NO");
        else System.out.println("YES");
    }

    }

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static byte nextByte() throws IOException {
        return Byte.parseByte(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);

        int n= Reader.nextInt();
        int k= Reader.nextInt();
        int a[] = new int [k];
        for (int i = 0; i < a.length; i++)
            a[i]=Reader.nextInt();

        Arrays.sort(a);

        int s=0;
        if(a[0]==1||a[a.length-1]==n)
        {
            System.out.println("NO");
            return;
        }
        //10 5
           //2 3 4 6 8
        int x=0,f=0;
        for (int i = 1; i <=n; i++)
        {
            x=0;
            for (int j = 0; j < a.length; j++) {
                if(i!=a[j])
                    x++;

            }
            if(x==a.length&&i-f<=3)
             {f=i;s++;}
            if(x==a.length&&i-f>3)
                s--;
        }

        System.out.println(s==(n-k)?"YES":"NO");

    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static public void nextIntArrays(int[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (int[] array : arrays) {
                array[i] = nextInt();
            }
        }
    }

    static public void nextLineArrays(String[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (String[] array : arrays) {
                array[i] = reader.readLine();
            }
        }
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);

        int n= Reader.nextInt();
        int k= Reader.nextInt();
        int a[] = new int [k];
        for (int i = 0; i < a.length; i++)
            a[i]=Reader.nextInt();

        //Arrays.sort(a);

        int s=0;
        if(a[0]==1||a[a.length-1]==n)
        {
            System.out.println("NO");
            return;
        }
        //10 5
           //2 3 4 6 8
        int x=0,f=0;
        for (int i = 1; i <=n; i++)
        {
            x=0;
            for (int j = 0; j < a.length; j++) {
                if(i!=a[j])
                    x++;
                else
                    break;
            }
            if(x==a.length&&i-f<=3)
             {f=i;s++;}
            if(x==a.length&&i-f>3)
            {
                System.out.println("NO");
                return;
            }
        }

        System.out.println(s==(n-k)?"YES":"NO");

    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static public void nextIntArrays(int[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (int[] array : arrays) {
                array[i] = nextInt();
            }
        }
    }

    static public void nextLineArrays(String[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (String[] array : arrays) {
                array[i] = reader.readLine();
            }
        }
    }
}


import java.util.*;

public class Main {

	public static void main (String[] args){

		Scanner in = new Scanner(System.in);

		int n=in.nextInt();
		int a[] = new int [in.nextInt()];

		for(int i = 0 ; i<a.length;i++)
		{
			a[i]=in.nextInt();
		}

		Arrays.sort(a);
		if(a[0]==1||a[a.length-1]==n)
		{
			System.out.print("NO");
			return;
		}
		int s=0;
		for(int i = 0 ; i<a.length;i++)
		{
			if(i+1<a.length)
			if(a[i+1]-a[i]==1)
				s++;
			else
				s=0;
			if(s>=2)
			{
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");

	}

}


import java.util.*;
public class User {

	public static void main (String[] args){

		Scanner in = new Scanner(System.in);

		int n=in.nextInt();
		int m=in.nextInt();
		if(m==0)
			{
			System.out.println("YES");
			return;
			}

		int a[] = new int [m];

		for(int i = 0 ; i<a.length;i++)
		{
			a[i]=in.nextInt();
		}

		Arrays.sort(a);
		if(a[0]==1||a[a.length-1]==n)
		{
			System.out.print("NO");
			return;
		}
		int s=0;
		for(int i = 0 ; i<a.length;i++)
		{
			if(i+1<a.length)
			if(a[i+1]-a[i]==1)
				s++;
			else
				s=0;
			if(s>=2)
			{
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");

	}
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);

        int n= Reader.nextInt();
        int k= Reader.nextInt();
        int a[] = new int [k];
        for (int i = 0; i < a.length; i++)
            a[i]=Reader.nextInt();

        Arrays.sort(a);

        int s=0;
        if(a[0]==1||a[a.length-1]==n)
        {
            System.out.println("NO");
            return;
        }
        //10 5
           //2 3 4 6 8
        int x=0,f=0;
        for (int i = 1; i <=n; i++)
        {
            x=0;
            for (int j = 0; j < a.length; j++) {
                if(i!=a[j])
                    x++;
                else
                    break;
            }
            if(x==a.length&&i-f<=3)
             {f=i;s++;}
           // if(x==a.length&&i-f>3)
             //   s--;
        }

        System.out.println(s==(n-k)?"YES":"NO");

    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static public void nextIntArrays(int[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (int[] array : arrays) {
                array[i] = nextInt();
            }
        }
    }

    static public void nextLineArrays(String[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (String[] array : arrays) {
                array[i] = reader.readLine();
            }
        }
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);

        int n= Reader.nextInt();
        int k= Reader.nextInt();
        int a[] = new int [k];
        for (int i = 0; i < a.length; i++)
            a[i]=Reader.nextInt();

        int s=0;
        if(a[0]==1||a[a.length-1]==n)
        {
            System.out.println("NO");
            return;
        }
        //10 5
           //2 3 4 6 8
        int x=0,f=0;
        for (int i = 1; i <=n; i++)
        {
            x=0;
            for (int j = 0; j < a.length; j++) {
                if(i!=a[j])
                    x++;
                else
                    break;
            }
            if(x==a.length&&i-f<=3)
             {f=i;s++;}
           // if(x==a.length&&i-f>3)
             //   s--;
        }

        System.out.println(s==(n-k)?"YES":"NO");

    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static public void nextIntArrays(int[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (int[] array : arrays) {
                array[i] = nextInt();
            }
        }
    }

    static public void nextLineArrays(String[]... arrays) throws IOException {
        for (int i = 1; i < arrays.length; ++i) {
            if (arrays[i].length != arrays[0].length) {
                throw new InputMismatchException("Lengths are different");
            }
        }
        for (int i = 0; i < arrays[0].length; ++i) {
            for (String[] array : arrays) {
                array[i] = reader.readLine();
            }
        }
    }
}


import java.util.*;

public class Main {

	public static void main (String[] args){

		Scanner in = new Scanner(System.in);

		int n=in.nextInt();
		int a[] = new int [in.nextInt()];

		for(int i = 0 ; i<a.length;i++)
		{
			a[i]=in.nextInt();
		}

		Arrays.sort(a);
		if(a[0]==1||a[a.length-1]==10)
		{
			System.out.print("NO");
			return;
		}
		int s=0;
		for(int i = 0 ; i<a.length;i++)
		{
			if(i+1<a.length)
			if(a[i+1]-a[i]==1)
				s++;
			else
				s=0;
			if(s>=2)
			{
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");

	}

}


import java.io.*;
import java.util.*;
public class A{
	public static void main(String[] args)throws IOException {
		//BufferedReader k = new BufferedReader(new FileReader("D:/uva-input.txt.txt"));
		BufferedReader k = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter z = new PrintWriter(System.out);
		String line;
		while((line = k.readLine())!=null){
			StringTokenizer s = new StringTokenizer(line);
			long n = Long.valueOf(s.nextToken());
			long m = Long.valueOf(s.nextToken());
			if(m>0){
				StringTokenizer ss = new StringTokenizer(k.readLine());
				ArrayList<Long> dirty = new ArrayList<Long>();

				while(ss.hasMoreTokens()){
					long j = Long.valueOf(ss.nextToken());
					dirty.add(j);
				}

				if(dirty.contains(n)||dirty.contains((long)1)){
					z.println("NO");
				}
				else{
					boolean ok = true;
					for(int c = 0;c<dirty.size();c++){
						long num = dirty.get(c);
						if(dirty.contains(num-1)){
							if(dirty.contains(num+1)){
								ok = false;
								break;
							}
						}
						else{
							if(dirty.contains(num+1)){
								if((num+2<=n) && dirty.contains(num+2)){
									ok = false;
									break;
								}
							}
						}
					}
					if(ok){
						z.println("YES");
					}
					else{
						z.println("NO");
					}
				}
			}
			else{
				z.println("YES");
			}

		}
		z.flush();
	}

}


import java.io.*;
import java.util.*;
public class A{
	public static void main(String[] args)throws IOException {
		//BufferedReader k = new BufferedReader(new FileReader("D:/uva-input.txt.txt"));
		BufferedReader k = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter z = new PrintWriter(System.out);
		String line;
		while((line = k.readLine())!=null){
			StringTokenizer s = new StringTokenizer(line);
			long n = Long.valueOf(s.nextToken());
			long m = Long.valueOf(s.nextToken());
			if(m>0){
				StringTokenizer ss = new StringTokenizer(k.readLine());
				ArrayList<Long> dirty = new ArrayList<Long>();

				while(ss.hasMoreTokens()){
					long j = Long.valueOf(ss.nextToken());
					dirty.add(j);
				}

				if(dirty.contains(n)||dirty.contains(1)){
					z.println("NO");
				}
				else{
					boolean ok = true;
					for(int c = 0;c<dirty.size();c++){
						long num = dirty.get(c);
						if(dirty.contains(num-1)){
							if(dirty.contains(num+1)){
								ok = false;
								break;
							}
						}
						else{
							if(dirty.contains(num+1)){
								if((num+2<=n) && dirty.contains(num+2)){
									ok = false;
									break;
								}
							}
						}
					}
					if(ok){
						z.println("YES");
					}
					else{
						z.println("NO");
					}
				}
			}
			else{
				z.println("YES");
			}

		}
		z.flush();
	}

}


n = int(input())
if n is 3:
    print(1,2,3)
    exit(0)
a=[0]*(n+1)
for i, l in enumerate(__import__('sys').stdin.readlines()):
    b, c = map(int, l.split())
    a[i + 1] = (b, c)
r = [0]*n
r[0]=1
for i in range(1, n):
    p, q = a[r[i - 1]]
    r[i] = p if q in a[p] else q
print(*r)


n=int(input())
deg=[]
for i in range(n):
    a=list(map(int,input().split()))
    deg.append(a)
if(n==3):
    print(1,2,3)
    exit(0)
r=[0]*n
r[0]=1
for i in range(1,n):
    fi,se=deg[r[i-1]-1]
    if(se in deg[fi-1]):
        r[i]=fi
    else:
        r[i]=se
print(*r)


n=int(input())
deg=[]
for i in range(n):
    a=list(map(int,input().split()))
    deg.append(a)
r=[0]*n
r[0]=1
for i in range(1,n):
    fi,se=deg[r[i-1]-1]
    if(se in deg[fi-1]):
        r[i]=fi
    else:
        r[i]=se
print(*r)


n=int(input().strip())
import collections
de=[]
A=[ 0 for i in range(n+5)]
for i in range(n):
    x,y=list(map(int,input().strip().split()))
    A[i+1]=(x,y)
de.append(1)
de.append(A[1][0])
de.append(A[1][1])
while(len(de)<n):
    #print(de)
    a=de[-2]
    b=de[-1]
    x=A[a]
    y=A[b]
    if(b in x):
        de.append(x[0]+x[1]-b)
    else:
        de[-1],de[-2]=de[-2],de[-1]

print(' '.join(map(str,de)))


N=int(input())
a=[]
for j in range(N):
    a.append([])
for i in range(N):
    n,m=map(int,input().split())
    a[i].append(n)
    a[i].append(m)
d=dict()
for j in range(1,N+1):
    d[j]=0
c=[]
c.append(1)
d[1]=1
n=a[0][0]
m=a[0][1]
d[n]=1
d[m]=1
if n in a[m-1]:
    c.append(m)
    c.append(n)
elif m in a[n-1]:
    c.append(n)
    c.append(m)
j=1
p=3
while(p!=N):
    n=a[c[j]-1][0]

    m=a[c[j]-1][1]

    if d[n]==0:
        c.append(n)
        d[n]=1
    elif d[m]==0:
        c.append(m)
        d[m]=1
    j+=1
    p+=1
print(*c)


def next(n):
    b=a[n-1][1]

    c=a[n-1][2]

    if b in a[c-1][1:]:
        return c
    else:
        return b

n=int(input())
a=[]
for _ in range(n):

    a1,a2=map(int,input().split())
    a.append([_+1,a1,a2])
ans=[1]
for i in range(n-1):
    ans.append(next(ans[-1]))
print(*ans)


def next(n):
    b=a[n-1][1]

    c=a[n-1][2]

    if b in a[c-1][1:]:
        return c
    else:
        return b

n=int(input())
a=[]
for _ in range(n):

    a1,a2=map(int,input().split())
    a.append([_+1,a1,a2])
ans=[1]
for i in range(n-1):
    ans.append(next(ans[-1]))
if n==3:
    print(1,2,3)
else:
    print(*ans)


n = int(input())
d,mark = {},{}
from sys import stdin
for i in range(n):
    a1,a2 = map(int,stdin.readline().split())
    d[i]=[a1,a2]
    mark[i]=False
a,b = d[0][0],d[0][1]
res=[]
for i in range(n//2):
    mark[a-1]=True
    mark[b-1]=True
    if d[a-1][0]==b or d[a-1][1]==b:
        res.append(a)
        res.append(b)
        a,b=d[b-1][0],d[b-1][1]
    else:
        res.append(b)
        res.append(a)
        a,b=d[a-1][0],d[a-1][1]
if mark[a-1]==False:
    res.append(a)
if mark[b-1]==False:
    res.append(b)
print(*res)


n = int(input())
memories = []
for i in range(n):
	memories.append(tuple(map(int,input().split())))
p = [1]
while len(p)<n:
	i = p[-1]
	x,y=memories[i-1]
	if y in memories[x-1]:
		p.append(x)
		p.append(y)
	else:
		p.append(y)
		p.append(x)
if len(p)>n:
	p.pop()
print(*p)


n = int(input())
graph = [[] for i in range(n+1)]
for i in range(n):
    s, e = input().strip().split(' ')
    s, e = [int(s), int(e)]

    graph[s].append(e)
    graph[e].append(s)

def dfsUtil(v, visited):
    visited[v] = True
    print(v, end=" ")

    for i in graph[v]:
        if visited[i] == False:
            dfsUtil(i, visited)

def dfs(graph):
    visited = [False] * (len(graph))
    dfsUtil(1, visited)

dfs(graph)


def check (arr,a,b):
    next = -1
    l = a
    r = b
    ans = []
    for i in range(1, len(arr)):
        ans.append(l)
        if (arr[l][0] == r):
            next = arr[l][1]
        elif (arr[l][1] == r):
            next = arr[l][0]
        else:
            return 0

        l = r
        r = next

    # print result
    for i in ans:
        print(i, end=" ")

    exit()

def main ():
    n = int(input())
    arr = [[] for x in range(n+1)]
    # print(arr)
    for i in range(1,n+1):
        x, y = input().strip().split(" ")
        x, y = [int(x), int(y)]
        arr[i].append(x)
        arr[i].append(y)

    check(arr, 1, arr[1][0])
    check(arr, 1, arr[1][1])

main()


n = int(input())

arr = [-1]

a = [[]]
for i in range(n):
    a.append(list(map(int,input().split())))

arr.append(1)
if a[1][0] not in a[a[1][1]]:
    arr.append(a[1][0])
    arr.append(a[1][1])
else:
    arr.append(a[1][1])
    arr.append(a[1][0])
while(len(arr) < n+1):
    if a[arr[-2]][0]  != arr[-1]:
        arr.append(a[arr[-2]][0])
    else:
        arr.append(a[arr[-2]][1])

for i in range(1,len(arr)-1):
    print(arr[i],end=" ")
print(arr[n])