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

namespace agc030_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var text = Console.ReadLine();
            var list = text.Split(' ').Select(x => int.Parse(x)).ToList();

            var n = list[0];
            var b = list[1];

            var blocks = new List<int>();
            for(int i = 0; i < b; i++){
                text = Console.ReadLine();
                blocks.Add(int.Parse(text));
            }

            blocks = blocks.OrderBy(x => x).ToList();
            for(int i = 1; i < blocks.Count; i++){
                if (blocks[i -1] == blocks[i] + 1){
                    Console.WriteLine("0");
                    return;
                }
            }

            var value = 0;
            if (blocks.Count == 0){
                var pow = blocks.Count / 2;
                var mod = blocks.Count % 2;
                value = Convert.ToInt32(Math.Pow(2, pow)) + mod;
            }
            else
            {
                var start = 0;
                for(int i = 0; i < blocks.Count; i++){
                    var point = blocks[i] - 1;
                    var stair = point - start;
                    var pow = stair / 2;
                    var mod = stair % 2;
                    value = value * Convert.ToInt32(Math.Pow(2, pow)) + mod;
                    start = point + 2;
                }

                var stair2 = n - start;
                var pow2 = stair2 / 2;
                var mod2 = stair2 % 2;
                value = value + Convert.ToInt32(Math.Pow(2, pow2)) + mod2;
            }

            var ans = value % 1000000007;
            Console.WriteLine(ans);
        }
    }
}
