#include<iostream>
#define ll long long int
using namespace std;
ll n, m, ans, ai[105], dp[10005];
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	dp[0] = { 1 };
	for (int i = 1; i <= m; i++)
		cin >> ai[i];
	for (int i = 1; i <= m; i++)
		for (int j = n; j >= ai[i]; j--)
			dp[j] += dp[j - ai[i]];
	cout << dp[n];
	return 0;
}