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]);

        if (N == 1) { Console.WriteLine("1"); }
        else {
            int ans = N - 1;
            int[] a = new int[M + 1];
            List<int> list = new List<int>();
            a[M + 1] = N + 2;
            for (int i = 0; i < M; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            for (int j = 0; j < M + 1; j++)
            {
                list.Add(a[j]);
            }


            IEnumerable<int> result = list.Distinct();
            int l = result.Count();
            if (l == 1) { Console.WriteLine(ans); }


            else
            {
                ans = a[0] - 1;
                int[] d = new int[l];
                for (int k = 0; k < l - 1; k++)
                {
                    d[k] = result[k + 1] - result[k];
                }
                for(int n = 0; n < l; n++)
                {
                    ans = ans + d[n] - 2;
                }

                for (int m = 0; m < l; m++)
                {
                 if(   d[m] == 1;){
                    ans = 0;
                    break;
                }
                }
            }

                Console.WriteLine(ans); 
                }
    }
