import numpy as np K = int(input()) N = int(input()) X = np.array(list(map(int, input().split()))) dp = np.zeros(K, dtype = int) Y = np.zeros(K, dtype = int) mod = 10**9 + 7 for x in X: if x < K: Y[-x] = 1 dp[x-1] = 1 for j in range(1,K): dp[j] += np.dot(Y[-j:], dp[:j]) dp[j] %= mod print(dp[-1])