# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 12:06:59 2020

@author: liang
"""


key = 10**9 + 7
N, M = map(int, input().split())

A = [int(input()) for _ in range(M)]
A.sort()
A += [-1]

def solve():
    steps = list()
    count = 0
    index = 0
    #段差数え
    for i in range(N+1):
        if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
    else:
         steps.append(count)
         count = 0
        
    smax = max(steps)
    fibs = [0] * smax
    #fibテーブル生成 O(n)
    for i in range(smax):
        if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
    else:
        ans = 1
        for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
    return ans

ans = solve()        
print(ans) """
Created on Sun Sep 13 12:06:59 2020

@author: liang
""" key = 10**9 + 7 key 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 = [int(input()) for _ in range(M)] A [int(input()) for _ in range(M)] A.sort() A.sort A sort A += [-1] A [-1] -1 def solve():
    steps = list()
    count = 0
    index = 0
    #段差数え
    for i in range(N+1):
        if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
    else:
         steps.append(count)
         count = 0
        
    smax = max(steps)
    fibs = [0] * smax
    #fibテーブル生成 O(n)
    for i in range(smax):
        if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
    else:
        ans = 1
        for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
    return ans solve steps = list() steps list() list count = 0 count 0 index = 0 index 0 for i in range(N+1):
        if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
    else:
         steps.append(count)
         count = 0
        
     i range(N+1) range N+1 N 1 if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
     i == A[index] i A[index] A index if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
         count == 0 count 0 return 0 0 steps.append(count) steps.append steps append count count = 0 count 0 if index < M:
                    index += 1
         index < M index M index += 1 index 1 count += 1 count 1 steps.append(count) steps.append steps append count count = 0 count 0 smax = max(steps) smax max(steps) max steps fibs = [0] * smax fibs [0] * smax [0] 0 smax for i in range(smax):
        if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
    else:
        ans = 1
        for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
     i range(smax) range smax if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
     i == 0 or i == 1 i == 0 i 0 i == 1 i 1 fibs[i] = 1 fibs[i] fibs i 1 fibs[i] = fibs[i-1] + fibs[i-2] fibs[i] fibs i fibs[i-1] + fibs[i-2] fibs[i-1] fibs i-1 i 1 fibs[i-2] fibs i-2 i 2 ans = 1 ans 1 for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
     s steps ans *= fibs[s-1] ans fibs[s-1] fibs s-1 s 1 ans %= key ans key return ans ans ans = solve() ans solve() solve print(ans) print ans A += [-1] [-1] A ans = solve() solve() ans def solve():
    steps = list()
    count = 0
    index = 0
    #段差数え
    for i in range(N+1):
        if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
    else:
         steps.append(count)
         count = 0
        
    smax = max(steps)
    fibs = [0] * smax
    #fibテーブル生成 O(n)
    for i in range(smax):
        if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
    else:
        ans = 1
        for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
    return ans def solve():
    steps = list()
    count = 0
    index = 0
    #段差数え
    for i in range(N+1):
        if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
    else:
         steps.append(count)
         count = 0
        
    smax = max(steps)
    fibs = [0] * smax
    #fibテーブル生成 O(n)
    for i in range(smax):
        if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
    else:
        ans = 1
        for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
    return ans solve N, M = map(int, input().split()) map(int, input().split()) N key = 10**9 + 7 10**9 + 7 key M = map(int, input().split()) map(int, input().split()) M A = [int(input()) for _ in range(M)] [int(input()) for _ in range(M)] A
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 12:06:59 2020

@author: liang
"""


key = 10**9 + 7
N, M = map(int, input().split())

A = [int(input()) for _ in range(M)]
A.sort()
A += [-1]

def solve():
    steps = list()
    count = 0
    index = 0
    #段差数え
    for i in range(N+1):
        if i == A[index]:
            if count == 0:
                return 0
            else:
                steps.append(count)
                count = 0
                if index < M:
                    index += 1
        else:
            count += 1
    else:
         steps.append(count)
         count = 0
        
    smax = max(steps)
    fibs = [0] * smax
    #fibテーブル生成 O(n)
    for i in range(smax):
        if i == 0 or i == 1:
            fibs[i] = 1
        else:
            fibs[i] = fibs[i-1] + fibs[i-2]  
    else:
        ans = 1
        for s in steps:
            #print(s)
            ans *= fibs[s-1]
            #print(ans)
            ans %= key
    #print(A)
    #print(steps)
    #print(fibs)
    return ans

ans = solve()        
print(ans)