MOD = 10**9 + 7 K = int(input()) N = int(input()) x = list(map(int, input().split())) x.sort(reverse=True) # Sort in descending order to break early dp = [0] * (K + 1) dp[0] = 1 # Base case: one way to stay at step 0 for k in range(1, K + 1): total = 0 for xi in x: if xi > k: continue # Skip steps larger than current k total += dp[k - xi] if total >= MOD: total -= MOD dp[k] = total % MOD print(dp[K] % MOD)