def getval():
    n,m = map(int,input().split())
    a = [int(input()) for i in range(m)]
    return n,m,a

def main(n,m,a):
    dp = [0 for i in range(n+1)]
    mod = 10**9 + 7
    dp[0] = 1
    it1 = iter(a)
    it2 = iter(a)
    d = dict(zip(it1,it2))
    for i in range(1,n+1):
        if i in d:
            continue
        if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

    print(dp[n])
    #print(dp)

if __name__=="__main__":
    n,m,a = getval()
    main(n,m,a)  def getval():
    n,m = map(int,input().split())
    a = [int(input()) for i in range(m)]
    return n,m,a getval n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m int(input()) for i in range(m) for i in range(m) i range(m) range m for i in range(m) int(input()) int input() input a = [int(input()) for i in range(m)] a [int(input()) for i in range(m)] return n,m,a return n,m,a n m a def main(n,m,a):
    dp = [0 for i in range(n+1)]
    mod = 10**9 + 7
    dp[0] = 1
    it1 = iter(a)
    it2 = iter(a)
    d = dict(zip(it1,it2))
    for i in range(1,n+1):
        if i in d:
            continue
        if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

    print(dp[n])
    #print(dp) main 0 for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) 0 dp = [0 for i in range(n+1)] dp [0 for i in range(n+1)] mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 dp[0] = 1 dp[0] dp 0 1 it1 = iter(a) it1 iter(a) iter a it2 = iter(a) it2 iter(a) iter a d = dict(zip(it1,it2)) d dict(zip(it1,it2)) dict zip(it1,it2) zip it1 it2 for i in range(1,n+1):
        if i in d:
            continue
        if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

     i range(1,n+1) range 1 n+1 n 1 if i in d:
            continue
         i in d i d continue if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

     i==1 i 1 dp[1] = dp[0] dp[1] dp 1 dp[0] dp 0 dp[i] = (dp[i-1] + dp[i-2]) % mod dp[i] dp i (dp[i-1] + dp[i-2]) % mod dp[i-1] + dp[i-2] dp[i-1] dp i-1 i 1 dp[i-2] dp i-2 i 2 mod print(dp[n]) print dp[n] dp n n n m m a a if __name__=="__main__":
    n,m,a = getval()
    main(n,m,a)  __name__=="__main__" __name__ "__main__" n,m,a = getval() n getval() getval m a main(n,m,a) main n m a a = getval() getval() a def getval():
    n,m = map(int,input().split())
    a = [int(input()) for i in range(m)]
    return n,m,a def getval():
    n,m = map(int,input().split())
    a = [int(input()) for i in range(m)]
    return n,m,a getval def main(n,m,a):
    dp = [0 for i in range(n+1)]
    mod = 10**9 + 7
    dp[0] = 1
    it1 = iter(a)
    it2 = iter(a)
    d = dict(zip(it1,it2))
    for i in range(1,n+1):
        if i in d:
            continue
        if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

    print(dp[n])
    #print(dp) def main(n,m,a):
    dp = [0 for i in range(n+1)]
    mod = 10**9 + 7
    dp[0] = 1
    it1 = iter(a)
    it2 = iter(a)
    d = dict(zip(it1,it2))
    for i in range(1,n+1):
        if i in d:
            continue
        if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

    print(dp[n])
    #print(dp) main n,m,a = getval() getval() n m,a = getval() getval() m
def getval():
    n,m = map(int,input().split())
    a = [int(input()) for i in range(m)]
    return n,m,a

def main(n,m,a):
    dp = [0 for i in range(n+1)]
    mod = 10**9 + 7
    dp[0] = 1
    it1 = iter(a)
    it2 = iter(a)
    d = dict(zip(it1,it2))
    for i in range(1,n+1):
        if i in d:
            continue
        if i==1:
            dp[1] = dp[0]
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % mod

    print(dp[n])
    #print(dp)

if __name__=="__main__":
    n,m,a = getval()
    main(n,m,a) 