n, m = map(int, input().split())
aa = {int(input()) for _ in range(m)}
dp = [0 for _ in range(n + 1)]
dp[0] = 1

if 1 not in aa:
    dp[1] = 1

for i in range(2, n + 1):
    if dp[i - 1] > 0 and (i - 1) not in aa:
        dp[i] += dp[i - 1]
    if dp[i - 2] > 0 and (i - 2) not in aa:
        dp[i] += dp[i - 2]

print(dp[-1] % 1000000007)
print(dp[-1])
