MOD = (10 ** 17) + 7 n, m = map(int, input().split()) x = list(map(int, input().split())) cost = [0 for _ in range(n)] cost[0] = 1 def areba(i, j): if i < j: return 0 else: return cost[i - j] for i in range(1, n): for j in x: cost[i] = (cost[i] + areba(i, j)) % MOD print(cost[-1])