#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 j = 0; j < k; ++j) { for (int i = 0; j + i <= k; ++i) { if ((dp[j + i] += f[i] * dp[j]) >= mod) dp[j + i] -= mod; } } cout << dp[k] << '\n'; }