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[] a = new int[M+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	}

} import java.util.*; util.* java public class Main {

	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+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	}

} Main 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+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[M+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int[] a = new int[M+1]; a new int[M+1] M+1 M 1 long[] fib = new long[N+2]; fib new long[N+2] N+2 N 2 fib[0] = 1 fib[0] fib 0 1 fib[1] = 1 fib[1] fib 1 1 fib[2] = 1 fib[2] fib 2 1 for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		} int i = 3; int i = 3; i 3 i <= N+1 i N+1 N 1 i++ i++ i {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		} {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		} fib[i] = fib[i-1] + fib[i-2] fib[i] fib i fib[i-1] + fib[i-2] fib[i-1] fib i-1 i 1 fib[i-2] fib i-2 i 2 fib[i] %= 1000000007 fib[i] fib i 1000000007 for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt(); int i = 1; int i = 1; i 1 i <= M i M i++ i++ i a[i] = sc.nextInt(); a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} int i = 2; int i = 2; i 2 i <= M i M i++ i++ i if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} a[i] - a[i-1] == 1 a[i] - a[i-1] a[i] a i a[i-1] a i-1 i 1 1 {
				System.out.println(0);
				return;
			} System.out.println(0) System.out.println System.out System System.out 0 return; List<Long> F = new ArrayList<>(); F new ArrayList<>() for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]); int i = 2; int i = 2; i 2 i <= M i M i++ i++ i F.add(fib[a[i]-a[i-1]-1]); F.add(fib[a[i]-a[i-1]-1]) F.add F fib[a[i]-a[i-1]-1] fib a[i]-a[i-1]-1 a[i]-a[i-1]-1 a[i] a i a[i-1] a i-1 i 1 1 if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]); M != 0 M 0 {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		} F.add(fib[a[1]]) F.add F fib[a[1]] fib a[1] a 1 F.add(fib[N-a[M]]) F.add F fib[N-a[M]] fib N-a[M] N a[M] a M F.add(fib[N+1]) F.add F fib[N+1] fib N+1 N 1 long ans = 1; ans 1 for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		} int i = 0; int i = 0; i 0 i < F.size() i F.size() F.size F i++ i++ i {
			ans *= F.get(i);
			ans %= 1000000007;
		} {
			ans *= F.get(i);
			ans %= 1000000007;
		} ans *= F.get(i) ans F.get(i) F.get F i ans %= 1000000007 ans 1000000007 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	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+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	}

} public class Main {

	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+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	}

} Main
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[] a = new int[M+1];
		long[] fib = new long[N+2];
		fib[0] = 1;
		fib[1] = 1;
		fib[2] = 1;
		for(int i = 3; i <= N+1; i++) {
			fib[i] = fib[i-1] + fib[i-2];
			fib[i] %= 1000000007;
		}
		for(int i = 1; i <= M; i++)
			a[i] = sc.nextInt();
		for(int i = 2; i <= M; i++)
			if(a[i] - a[i-1] == 1) {
				System.out.println(0);
				return;
			} 
		List<Long> F = new ArrayList<>();
		for(int i = 2; i <= M; i++)
			F.add(fib[a[i]-a[i-1]-1]);
		if(M != 0) {
			F.add(fib[a[1]]);
			F.add(fib[N-a[M]]);
		}
		else
			F.add(fib[N+1]);
		long ans = 1;
		for(int i = 0; i < F.size(); i++) {
			ans *= F.get(i);
			ans %= 1000000007;
		}
		System.out.println(ans);

	}

}