import sys
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD=10**9+7
n,m=map(int,input().split())
a=set([int(input()) for _ in range(m)])
if n==1:
  print(1)
  exit()
if 1 in a and 2 in a:
  print(0)
  exit()
elif 1 in a:
  ans=[0,0,1]
elif 2 in a:
  ans=[0,1,0]
else:
  ans=[0,1,2]

@lru_cache(maxsize=None)
def cnt(x):
  if x<3:
    return ans[x]
  if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD

print(cnt(n)) import sys sys from functools import lru_cache sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m int(input()) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) int(input()) int input() input a=set([int(input()) for _ in range(m)]) a set([int(input()) for _ in range(m)]) set [int(input()) for _ in range(m)] if n==1:
  print(1)
  exit() n==1 n 1 print(1) print 1 exit() exit if 1 in a and 2 in a:
  print(0)
  exit()
elif 1 in a:
  ans=[0,0,1]
elif 2 in a:
  ans=[0,1,0]
else:
  ans=[0,1,2] 1 in a and 2 in a 1 in a 1 a 2 in a 2 a print(0) print 0 exit() exit elif 1 in a:
  ans=[0,0,1] 1 in a 1 a ans=[0,0,1] ans [0,0,1] 0 0 1 elif 2 in a:
  ans=[0,1,0] 2 in a 2 a ans=[0,1,0] ans [0,1,0] 0 1 0 ans=[0,1,2] ans [0,1,2] 0 1 2 def cnt(x):
  if x<3:
    return ans[x]
  if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD cnt if x<3:
    return ans[x]
   x<3 x 3 return ans[x] ans[x] ans x if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD x in a x a return 0 0 return (cnt(x-1)+cnt(x-2))%MOD (cnt(x-1)+cnt(x-2))%MOD cnt(x-1)+cnt(x-2) cnt(x-1) cnt x-1 x 1 cnt(x-2) cnt x-2 x 2 MOD x x @lru_cache(maxsize=None) cnt maxsize=None @lru_cache(maxsize=None) lru_cache maxsize=None maxsize None cnt print(cnt(n)) print cnt(n) cnt n MOD=10**9+7 10**9+7 MOD def cnt(x):
  if x<3:
    return ans[x]
  if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD def cnt(x):
  if x<3:
    return ans[x]
  if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD cnt m=map(int,input().split()) map(int,input().split()) m ans=[0,1,2] [0,1,2] ans n,m=map(int,input().split()) map(int,input().split()) n a=set([int(input()) for _ in range(m)]) set([int(input()) for _ in range(m)]) a ans=[0,1,0] [0,1,0] ans ans=[0,0,1] [0,0,1] ans
import sys
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD=10**9+7
n,m=map(int,input().split())
a=set([int(input()) for _ in range(m)])
if n==1:
  print(1)
  exit()
if 1 in a and 2 in a:
  print(0)
  exit()
elif 1 in a:
  ans=[0,0,1]
elif 2 in a:
  ans=[0,1,0]
else:
  ans=[0,1,2]

@lru_cache(maxsize=None)
def cnt(x):
  if x<3:
    return ans[x]
  if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD

print(cnt(n))