from scipy.special import comb
 
a = list(map(int, input().split()))
b = [int(input()) for i in range(a[1])]

count = 0
for i in range(a[1]):
  if (b[i] + 1 == b[i+1] && a[1] >= 2) :
    print("0")
    return 0;
  else :
    if i == 0:
      // x + 2y = b[i]
      if (b[i]-1) % 2 == 1: // b[i] = 2m + 1, x = 2n + 1, y = m - n
        for j in range(b[i] - b[i-1] - 1, 0, -2):
          x = j
          y = (b[i] - x)/2
          if x>=1 && y>=1 :
            count += comb(x+y, y, exact=True)
          else :
            count += 1
      else : // b[i] = 2m, y = 2n, x = b[i] - y
        for j in range((b[i] - 1)/2, -1, -1):
          y = j
          x = b[i] - 2*y
          if x>=1 && y>=1 :
            count += comb(x+y, y, exact=True)
          else :
            count += 1
    else :
      // x + 2y = b[i]
    if (b[i]-b[i-1]-1) % 2 == 1: // b[i] = 2m + 1, x = 2n + 1, y = m - n
      for j in range(b[i] - b[i-1] - 1, 0, -2):
        x = j
        y = (b[i] - x)/2
        if x>=1 && y>=1 :
          count += comb(x+y, y, exact=True)
        else :
          count += 1
    else : // b[i] = 2m, y = 2n, x = b[i] - y
      for j in range((b[i] - b[i-1] - 1)/2, -1, -1):
        y = j
        x = b[i] - 2*y
        if x>=1 && y>=1 :
          count += comb(x+y, y, exact=True)
        else :
          count += 1
  print(count%1000000007)