Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in range(1,N):
    if i in a:
        count += 1
        if count == 2:
            print(0)
            exit()
    else:
        count = 0

for i in a:
    dp[i] = 0
if 1 in a:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in range(1,N):
    if i in a:
        count += 1
        if count == 2:
            print(0)
            exit()
    else:
        count = 0

for i in range(N):
    if i in a:
        dp[i] = 0
if 1 in a:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [0]*(N+1) #dp[i]...i番目にいる時の移動方法の数
dp[0] = 1

count = 0
for i in range(1,N):
    if i in a:
        count += 1
        if count == 2:
            print(0)
            exit()
    else:
        count = 0
    
if 1 in a:
    dp[2] = 1
    for i in range(1,N-1):
        dp[i+2] = dp[i+1] + dp[i]
        dp[i+2] %= Mod
        if i+2 in a:
            dp[i+2] = 0
else:
    dp[1] = 1
    for i in range(N-1):
        dp[i+2] = dp[i+1] + dp[i]
        dp[i+2] %= Mod
        if i+2 in a:
            dp[i+2] = 0
print(dp[N])

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [0]*(N+1) #dp[i]...i番目にいる時の移動方法の数
dp[0] = 1

count = 0
for i in range(1,N):
    if i in a:
        count += 1
        if count == 2:
            print(0)
            exit()
    else:
        count = 0
    
if 1 in a:
    dp[2] = 1
    for i in range(1,N-1):
        dp[i+2] = dp[i+1] + dp[i]
        dp[i+2] %= Mod
        if i+2 in a:
            dp[i+2] = 0
else:
    dp[1] = 1
    for i in range(N-1):
        dp[i+2] = dp[i+1] + dp[i]
        dp[i+2] %= Mod
        if i+2 in a:
            dp[i+2] = 0
print(dp[N])

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [0]*(N+1) #dp[i]...i番目にいる時の移動方法の数
dp[0] = 1

count = 0
for i in range(1,N):
    if i in a:
        count += 1
        if count == 2:
            print(0)
            exit()
    else:
        count = 0
    
if 1 in a:
    dp[2] = 1
    for i in range(1,N-1):
        dp[i+2] = dp[i+1] + dp[i]
        if i+2 in a:
            dp[i+2] = 0
else:
    dp[1] = 1
    for i in range(N-1):
        dp[i+2] = dp[i+1] + dp[i]
        if i+2 in a:
            dp[i+2] = 0
print(dp[N]%Mod)

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])