import bisect MOD = 10**9 + 7 K = int(input()) N = int(input()) x = list(map(int, input().split())) x.sort() dp = [0] * (K + 1) dp[0] = 1 # Base case: 0 steps, 1 way for k in range(1, K + 1): # Find the rightmost index where x[i] <= k idx = bisect.bisect_right(x, k) - 1 total = 0 for i in range(idx + 1): d = x[i] if k - d >= 0: total += dp[k - d] total %= MOD dp[k] = total % MOD print(dp[K] % MOD)