#pragma GCC optimize ("Ofast,unroll-loops") #pragma GCC target ("avx") #include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; #ifdef __linux__ #define getchar getchar_unlocked #define putchar putchar_unlocked #endif int read_int(){int c,r;while((c=getchar())<48);r=c-48;while((c=getchar())>47)r=r*10+c-48;return r;} void write_int(int x){int b[10],*p=b;do*p++=48+x%10,x/=10;while(x);do putchar(*--p);while(p>b);} constexpr int mod = 1e9 + 7; int x[100000], dp[100001]; int main() { int k = read_int(); int n = read_int(); for (int i = 0; i < n; ++i) x[i] = read_int(); dp[0] = 1; for (int j = 0; j < k; ++j) { for (int i = 0; i < n; ++i) { if (j + x[i] > k) break; if ((dp[j + x[i]] += dp[j]) >= mod) dp[j + x[i]] -= mod; } } cout << dp[k] << '\n'; }