Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 10**9+7
dp = [0]*(N+1)

dp[0] = 1
dp[1] = 1

for i in range(1, N):
    if i not in List:
        dp[i+1] = dp[i]+dp[i-1]
    else:
        dp[i] = 0
        dp[i+1] = dp[i-1]
            
print(dp[N]%P)

Fixed submission:
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 10**9+7

dp = [1]*(N+1)

for a in List:
    dp[a]=0

for i in range(1, N+1):
    if (i>=2)&(dp[i]!=0):
        dp[i] = (dp[i-1]+dp[i-2])%P
        
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 1000000007

if N==1:
    print(1)
    
else:
    dp = [0]*(N+1)

    if 1 in List:
        dp[1] = 0
        if 2 in List:
            dp[2] = 0
        else:
            dp[2] = 1
    else:
        dp[1] = 1
        if 2 in List:
            dp[2] = 0
        else:
            dp[2] = 2

    for i in range(2, N):
        if i+1 in List:
            dp[i+1]=0
        else:
            if i in List:
                dp[i+1] = dp[i-1]
            else:
                dp[i+1] = (dp[i]+dp[i-1])
        
    print(dp[N]%P)

Fixed submission:
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 10**9+7

dp = [1]*(N+1)

for a in List:
    dp[a]=0

for i in range(1, N+1):
    if (i>=2)&(dp[i]!=0):
        dp[i] = (dp[i-1]+dp[i-2])%P
        
print(dp[N])

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 1000000007

if N==1:
    print(1)
    
else:
    dp = [0]*(N+1)

    if 1 in List:
        dp[1] = 0
        if 2 in List:
            dp[2] = 0
        else:
            dp[2] = 1
    else:
        dp[1] = 1
        if 2 in List:
            dp[2] = 0
        else:
            dp[2] = 2

    for i in range(2, N):
        if i+1 in List:
            dp[i+1]=0
        else:
            if i in List:
                dp[i+1] = dp[i-1]
            else:
                dp[i+1] = (dp[i]+dp[i-1])
        
    print(dp[N]%P)

Fixed submission:
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 10**9+7

dp = [1]*(N+1)

for a in List:
    dp[a]=0

for i in range(1, N+1):
    if (i>=2)&(dp[i]!=0):
        dp[i] = (dp[i-1]+dp[i-2])%P
        
print(dp[N])

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 1000000007

dp = [0]*(N+1)

if 1 in List:
    dp[1] = 0
    if 2 in List:
        dp[2] = 0
    else:
        dp[2] = 1
else:
    dp[1] = 1
    if 2 in List:
        dp[2] = 0
    else:
        dp[2] = 2

for i in range(2, N):
    if i+1 in List:
        dp[i+1]=0
    else:
        if i in List:
            dp[i+1] = dp[i-1]%P
        else:
            dp[i+1] = (dp[i]+dp[i-1])%P
        
print(dp[N])

Fixed submission:
N, M = map(int, input().split())
List = [int(input()) for _ in range(M)]

P = 10**9+7

dp = [1]*(N+1)

for a in List:
    dp[a]=0

for i in range(1, N+1):
    if (i>=2)&(dp[i]!=0):
        dp[i] = (dp[i-1]+dp[i-2])%P
        
print(dp[N])