using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{

	public static void Main(string[] args)
	{
	
		string[] s = Console.ReadLine().Split(' ');
		int n = int.Parse(s[0]);
		int m = int.Parse(s[1]);
		
		bool[] a = new bool[n];
		int last = -10;
		int q = 0;
		long ppp = 1;
		for(int i = 0; i < m; i++)
		{
			int index = int.Parse(Console.ReadLine());
			if(index == last+1) {
				Console.WriteLine(0);
				return;
			}
			a[index]=true;
			
			int o = Math.Max(0,last);
			if(index-o-1>1)
			{
				q = (index-o-1);
				ppp *= CountPattern(q);
				ppp %= 1000000007;
				//Console.WriteLine("q,[{0},{1}]/{2} {3}",o,index-1, q, ppp);
			}
			last = index;
		}
		q = (n-Math.Max(0,last+1));
		if(q>1)
		{
			//Console.WriteLine("q+"+q+","+CountPattern(q));
			ppp *= Math.Max(1,CountPattern(q));
			
				//Console.WriteLine("q,[{0},{1}]/{2} {3}",Math.Max(0,last+1),n, q, ppp);
			
		
		}
		
		
		Console.WriteLine(ppp%1000000007);
	
		
	}
	public static int count;
	public static Dictionary<int,int> kekka = new Dictionary<int,int>();
	public static int CountPattern(int n)
	{
		count = 0;
		if(kekka.ContainsKey(n))
			return kekka[n];
		C(0, n);
		kekka.Add(n,count);
		return count;
	}
	
	public static void C(int p, int n)
	{
		A(p,n);
		B(p,n);
	}
	
	public static bool A(int p, int n)
	{
		p+=2;
		
		if(p==n) {
			count++;
			return true;
		}
		if(p<n) {
			C(p,n);
		}
		return false;
	}
	
	public static bool B(int p, int n)
	{
		p+=1;
		if(p==n) {
			count++;
			return true;
		}
		if(p<n) {
			C(p,n);
		}
		return false;
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}

