#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include int ri() { int n; scanf("%d", &n); return n; } int dp[100001]; int main() { int k = ri(), n = ri(); int a[n]; for (int i = 0; i < n; i++) a[i] = ri(); dp[0] = 1; int start = 0; for (int i = 1; i <= k; i++) { int64_t cur = 0; while (start < n && a[start] <= i) start++; for (int j = 0; j < start; j++) cur += dp[i - a[j]]; dp[i] = cur % 1000000007; } std::cout << dp[k] << std::endl; return 0; }