def main():
  n, m = map(int,input().split())
  BStep = [int(input()) for _ in range(m)]

  sumstep = culc(0,BStep[0]-1)
  for i in range(1,m):
    sumstep*=culc(BStep[i-1]+1,BStep[i]-1)
  sumstep*=culc(BStep[m-1]+1,n)
  print(sumstep%1000000007)

def culc(fromstep,tostep):
  if tostep-fromstep==0:
    ans = 1
  elif tostep<=fromstep:
    ans = 0
  else:
    stepsum = 0
    up = tostep - fromstep
    tsmax = up//2
    for i in range(tsmax+1):
      one = up - 2*i
      stepsum += per(one + i)//(per(one)*per(i))
      # print(" ",stepsum)
    ans = stepsum
  # print(ans)
  return ans
def per(n):
  if n == 0:
    return 1
  else:
    return n*per(n-1)

main()