using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        string[] inputnm = Console.ReadLine().Split(' ');
        int N = int.Parse(inputnm[0]);
        int M = int.Parse(inputnm[1]);
        int[] a = new int[M+1];
        for(int i = 0; i < M; i++)
        {
            a[i] = int.Parse(Console.ReadLine());
        }
        a[M] = N + 1;
        int[] D = new int[M];
        int ans = N;

        if (M == 0) { Console.WriteLine(N); }
        else
        {
            for (int i = 0; i < M; i++)
            {
                D[i] = a[i + 1] - a[i];
                if (D[i] == 1)
                {
                    ans = 0;
                    break;
                }
                if (D[i] == 0)
                {
                    D[i] = 2;
                }

            }
            if (ans == 0)
            {
                Console.WriteLine(ans);
            }
            else
            {
                ans = a[0] - 1;
                for (int i = 0; i < M; i++)
                {
                    ans = ans + D[i] - 2;
                }
                Console.WriteLine(ans % 1000000007);
            }

        }
        


    }
}


