import sys import numpy as np sys.setrecursionlimit(10 ** 9) K = int(input()) N = int(input()) X = np.array(list(map(int, input().split()))) P = 10 ** 9 + 7 note = np.full(K + 1, -1) note[0] = 0 def main(x): if note[x] != -1: return note[x] note[x] = 0 for i in range(np.searchsorted(X, x, side='right')): note[x] += main(x - X[i]) note[x] %= P return note[x] print(main(K))