Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [0 for i in range(n+1)]
a.sort()
for i in range(1,n+1):
        if i in a:
                a.pop(0)
                dp[i] = 0
                continue
        if i == 1:
                dp[i] = 1
                continue
        if i == 2:
                if dp[i-1] == 0:
                        dp[i] = 1
                else:
                        dp[i] = 2
                continue
        if dp[i-1] == 0:
                dp[i] = dp[i-2]
                continue
        if dp[i-2] == 0:
                dp[i] = dp[i-1]
                continue
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
        #print (dp[i])
print (dp[-1]%(10**9+7))

Fixed submission:
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [10**5 for i in range(n+1)]
for i in a:
        dp[i] = 0

a.sort()
for i in range(1,n+1):
        if dp[i] == 0:
                continue
        if i == 1:
                dp[i] = 1
                continue
        if i == 2:
                if dp[i-1] == 0:
                        dp[i] = 1
                else:
                        dp[i] = 2
                continue
        if dp[i-1] == 0:
                dp[i] = dp[i-2]
                continue
        if dp[i-2] == 0:
                dp[i] = dp[i-1]
                continue
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
        #print (dp[i])
print (dp[-1]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [0 for i in range(n+1)]
a.sort()
for i in range(1,n+1):
        if i in a:
                a.pop(0)
                dp[i] = 0
                continue
        if i == 1:
                dp[i] = 1
                continue
        if i == 2:
                if dp[i-1] == 0:
                        dp[i] = 1
                else:
                        dp[i] = 2
                continue
        if dp[i-1] == 0:
                dp[i] = dp[i-2]
                continue
        if dp[i-2] == 0:
                dp[i] = dp[i-1]
                continue
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
        #print (dp[i])
print (dp[-1]%(10**9+7))

Fixed submission:
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [10**5 for i in range(n+1)]
for i in a:
        dp[i] = 0

a.sort()
for i in range(1,n+1):
        if dp[i] == 0:
                continue
        if i == 1:
                dp[i] = 1
                continue
        if i == 2:
                if dp[i-1] == 0:
                        dp[i] = 1
                else:
                        dp[i] = 2
                continue
        if dp[i-1] == 0:
                dp[i] = dp[i-2]
                continue
        if dp[i-2] == 0:
                dp[i] = dp[i-1]
                continue
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
        #print (dp[i])
print (dp[-1]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [0 for i in range(n+1)]


for i in range(1,n+1):
        if i in a:
                dp[i] = 0
                continue
        if i == 1:
                dp[i] = 1
                continue
        if i == 2:
                if dp[i-1] == 0:
                        dp[i] = 1
                else:
                        dp[i] = 2
                continue
        if dp[i-1] == 0:
                dp[i] = dp[i-2]
                continue
        if dp[i-2] == 0:
                dp[i] = dp[i-1]
                continue
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
        #print (dp[i])
print (dp[-1]%(10**9+7))

Fixed submission:
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [10**5 for i in range(n+1)]
for i in a:
        dp[i] = 0

a.sort()
for i in range(1,n+1):
        if dp[i] == 0:
                continue
        if i == 1:
                dp[i] = 1
                continue
        if i == 2:
                if dp[i-1] == 0:
                        dp[i] = 1
                else:
                        dp[i] = 2
                continue
        if dp[i-1] == 0:
                dp[i] = dp[i-2]
                continue
        if dp[i-2] == 0:
                dp[i] = dp[i-1]
                continue
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
        #print (dp[i])
print (dp[-1]%(10**9+7))