n, m = map(int, input().split())
r = [1]
mod = 1000000007
a = [int(input())]

for i in range(n):
  if i == a[-1] - 1:
    if len(a) < m:
      a.append(int(input()))
    r.append(0)
  elif i == 0:
    r.append(1)
  else:
    r.append((r[i] + r[i-1]) % mod)
print(r[-1])