#region Header #!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools from queue import PriorityQueue import bisect import heapq def input(): return sys.stdin.readline()[:-1] sys.setrecursionlimit(1000000) #endregion # _INPUT = """4 # 2 # 1 3 # """ # sys.stdin = io.StringIO(_INPUT) MOD = 1000000007 def main(): K = int(input()) N = int(input()) x = list(map(int, input().split())) dp = [0 for _ in range(K+1)] dp[0] = 1 for i in range(1, K+1): for j in range(N): if x[j] > i: break dp[i] = (dp[i] + dp[i-x[j]]) % MOD print(dp[K] % MOD) if __name__ == '__main__': main()