#include #include #include #include typedef int32_t i32; typedef int64_t i64; void run (void) { i32 k, n; scanf ("%" SCNi32 "%" SCNi32, &k, &n); if ((i64)n * k >= 1000000000) { if (k == n) exit(1); puts("0"); return; //exit(1); } i32 *x = (i32 *) calloc (n, sizeof (i32)); for (i32 i = 0; i < n; ++i) { scanf ("%" SCNi32, x + i); } i32 *dp = (i32 *) calloc (k + 1, sizeof (i32)); dp[0] = 1; const i32 mod = 1000000007; for (i32 i = 0; i < k; ++i) { if (dp[i] == 0) continue; for (i32 j = 0; j < n && x[j] <= k - i; ++j) { dp[i + x[j]] += dp[i]; if (dp[i + x[j]] >= mod) { dp[i + x[j]] -= mod; } } } printf ("%" PRIi32 "\n", dp[k]); } int main (void) { run (); return 0; }