The harbor bell rings at the seal rocks of Barking Cove; Alaric weighs the day's runs manifests and starts the calculations. Task: Coins of n given sizes may be used without limit. Print the number of combinations summing to amount (order does not matter) mod 1000000007. Input format: First line: amount and n. Second line: n distinct coin sizes. Output format: Print the count mod 1000000007. Constraints: 0 <= amount <= 4000; 1 <= n <= 30; 1 <= coin <= 10^4.
Example 1:
Example 2:
Example 3:
Constraints:
0 <= amount <= 4000; 1 <= n <= 30; 1 <= coin <= 10^4.
