N,M = list(map(int,input().split()))
lst = []
for i in range(M):
  a = int(input())
  lst.append(a)
#print(lst)

for i in range(M-1):
  if lst[i] == lst[i+1]:
    print("0")


if 1 in lst and not 3 in lst:
  lst2 = [0,1,1]
  for j in range(4,N+1):
    #print(j)
    if j in lst:
      lst2.append(0)
    else:
      #print(lst2,lst2[-1],lst2[-2])
      lst2.append(lst2[-1]+lst2[-2])
elif 2 in lst:
  lst2 = [1,0,1]
  for j in range(4,N+1):
    #print(j)
    if j in lst:
      lst2.append(0)
    else:
      #print(lst2,lst2[-1],lst2[-2])
      lst2.append(lst2[-1]+lst2[-2])
elif 3 in lst and not 1 in lst:
  lst2 = [1,2,0]
  for j in range(4,N+1):
    #print(j)
    if j in lst:
      lst2.append(0)
    else:
      #print(lst2,lst2[-1],lst2[-2])
      lst2.append(lst2[-1]+lst2[-2])
elif 1 in lst and 3 in lst:
  lst2 = [0,1,0]
  for j in range(4,N+1):
    #print(j)
    if j in lst:
      lst2.append(0)
    else:
      #print(lst2,lst2[-1],lst2[-2])
      lst2.append(lst2[-1]+lst2[-2])
else:
  lst2 = [1,2,3]
  for j in range(4,N+1):
    #print(j)
    if j in lst:
      lst2.append(0)
    else:
      #print(lst2,lst2[-1],lst2[-2])
      lst2.append(lst2[-1]+lst2[-2])
#print(lst2)
#print(lst[-1])
#print(lst2[-1])
print(lst2[-1]%1000000007)