n,m = map(int,input().split()) x = list(map(int,input().split())) x.sort() dp = [0 for i in range(n)] p = 100000000000000007 for i in range(m): dp[x[i]] += 1 for i in range(n): for j in range(m): if i - x[j] >= 0: dp[i] += dp[i-x[j]] if dp[i] > p: dp[i] %= p print(dp[n-1])