#include #include #include #include #include #include typedef int32_t i32; typedef int64_t i64; #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define ABS(a) ((a) > (0) ? (a) : -(a)) void run (void) { i32 k, n; scanf ("%" SCNi32 "%" SCNi32, &k, &n); 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; }