K=int(input()) N=int(input()) X=list(map(int, input().split())) mod=10**9+7 dp=[0]*(K+1) dp[0]=1 for i in range(K): ok=-1 ng=N while abs(ok-ng)>1: c=(ok+ng)//2 if K-i>=X[c]: ok=c else: ng=c if ok==-1: break for k in range(ok+1): dp[i+X[k]]+=dp[i] dp[i+X[k]]%=mod print(dp[-1])