Buggy python submission (verdict: Runtime Error):
MOD=10**9+7

N,_,*a = map(int, open(0).read().split())
A=set(a)
dp = [0 for _ in range(N+1)]
for i in range(1,3):
    if i not in A:
        dp[i]=dp[i-1]+1
for i in range(3,N+1):
    if i not in A:
        dp[i]=(dp[i-1]+dp[i-2])%MOD
    
print(dp[N])


Fixed submission:
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
    if dp[i] > -1:
        return dp[i]
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%MOD
    return dp[i]
    
print(rec(N))

Buggy python submission (verdict: Runtime Error):
MOD=10**9+7

N,_,*a = map(int, open(0).read().split())
A=set(a)
dp = [0 for _ in range(N+1)]
for i in range(1,3):
    if i not in A: dp[i]=dp[i-1]+1
for i in range(3,N+1):
    if i not in A: dp[i]=(dp[i-1]+dp[i-2])%MOD
    
print(dp[N])

Fixed submission:
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
    if dp[i] > -1:
        return dp[i]
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%MOD
    return dp[i]
    
print(rec(N))

Buggy python submission (verdict: Time Limit Exceeded):
a=open(0)
N,_,*a = map(int, a.read().split())

l,m = [0,0]
for i in range(1, N+1):
    if i in a:
        l,m = m,0
    elif i<3:
        l,m = m,m+1
    else:
        l,m = m,(l+m)%1000000007
print(m)



Fixed submission:
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
    if dp[i] > -1:
        return dp[i]
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%MOD
    return dp[i]
    
print(rec(N))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(2147483647)

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(150000)]
dp[0] = 0
def rec(i):
    if dp[i] >= 0:
        return dp[i]
    if i in a:
        dp[i] = 0
        return 0
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%1000000007
    return dp[i]
    
print(rec(N))




Fixed submission:
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
    if dp[i] > -1:
        return dp[i]
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%MOD
    return dp[i]
    
print(rec(N))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(3000)

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(150000)]
dp[0] = 0
def rec(i):
    if dp[i] >= 0:
        return dp[i]
    if i in a:
        dp[i] = 0
        return 0
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%1000000007
    return dp[i]
    
print(rec(N))




Fixed submission:
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
    if dp[i] > -1:
        return dp[i]
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%MOD
    return dp[i]
    
print(rec(N))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2000)

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(150000)]
dp[0] = 0
def rec(i):
    if dp[i] >= 0:
        return dp[i]
    if i in a:
        dp[i] = 0
        return 0
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%1000000007
    return dp[i]
    
print(rec(N))




Fixed submission:
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 1000000007

a=open(0)
N,_,*a = map(int, a.read().split())

dp = [-1 for _ in range(100010)]
dp[0] = 0
for i in a: dp[i] = 0
def rec(i):
    if dp[i] > -1:
        return dp[i]
    if i<3:
        dp[i] = rec(i-1) + 1
        return dp[i]
    dp[i] = (rec(i-1)+rec(i-2))%MOD
    return dp[i]
    
print(rec(N))