#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; constexpr int N = 1e5; int dp[N + 1], f[N + 1]; int main() { int k = read_int(); int n = read_int(); for (int i = 0; i < n; ++i) { f[read_int()] = 1; } dp[0] = 1; for (int i = 0; i < k; ++i) { const int c = dp[i]; for (int x = 0; i + x <= k; ++x) { dp[i + x] += f[x] * c; dp[i + x] -= (dp[i + x] >= mod) * mod; } } cout << dp[k] << '\n'; }