def fib(x):
  if x==0:
    return 0
  elif x==1 or x==2:
  	return 1
  else:
  	return fib(x-2)+fib(x-1)

N,M=(int(x) for xin input().split())
a=[int(input()) for i in range(M)]
x=1
for i in range(1,M):
  x*=fib(a[i]-a[i-1])

print (a%((10e+9)+7))