MOD = 10**9 + 7 K = int(input()) N = int(input()) x = list(map(int, input().split())) # Filter out steps larger than K and sort them x = [xi for xi in x if xi <= K] x.sort() dp = [0] * (K + 1) dp[0] = 1 # Base case: one way to stay at 0 steps for k in range(1, K + 1): for xi in x: if xi > k: break # Since x is sorted, no need to check further dp[k] += dp[k - xi] dp[k] %= MOD print(dp[K] % MOD)