Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

mod = 1000000007
N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    if x > 2:
        return fibonacci(x-1) + fibonacci(x-2)
    else:
        return 1

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1) % mod
    res %= mod
    prev_a = cur_a
    continue

print(res)


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

mod = 1000000007
N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    a = 1
    b = 1
    if x <= 2:
        return a
    else:
        for _ in range(x-2):
            tmp = a
            a = b
            b = tmp + b
        return b

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1) % mod
    res %= mod
    prev_a = cur_a
    continue

print(res)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    if x > 2:
        return fibonacci(x-1) + fibonacci(x-2)
    else:
        return 1

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1)
    res %= 1000000007
    prev_a = cur_a
    continue

print(res)


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

mod = 1000000007
N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    a = 1
    b = 1
    if x <= 2:
        return a
    else:
        for _ in range(x-2):
            tmp = a
            a = b
            b = tmp + b
        return b

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1) % mod
    res %= mod
    prev_a = cur_a
    continue

print(res)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]

def fibonacci(x):
    if x > 2:
        return fibonacci(x-1) + fibonacci(x-2)
    else:
        return 1

res = 1
count = 0
for i in range(N+1):
    if i in a:
        if count == 0:
            res = 0
            break
        res *= fibonacci(count)
        res %= 1000000007
        count = 0
        continue
    count += 1

if res != 0:
    res *= fibonacci(count)
    res %= 1000000007

print(res)


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

mod = 1000000007
N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    a = 1
    b = 1
    if x <= 2:
        return a
    else:
        for _ in range(x-2):
            tmp = a
            a = b
            b = tmp + b
        return b

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1) % mod
    res %= mod
    prev_a = cur_a
    continue

print(res)