#include<bits/stdc++.h>
using namespace std;
long long int coins[100];
int n,m;
long long int dp[280][100];
void solve(int n ,int m)
{
for(int i=0;i<=n;++i){
dp[0][i] = 0;
}
for(int i=1;i<=m;++i){
dp[i][0] = 1;
}
for(int idx=1;idx<=m;++idx)
{
for(int sum=1;sum<=n;++sum){
dp[idx][sum] = dp[idx-1][sum];
if(sum-coins[idx]<0)
continue;
else{
dp[idx][sum] += dp[idx][sum-coins[idx]];
}
}
}
cout<<dp[m][n];
}
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=m;++i)cin>>coins[i];
solve(n,m);
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmxvbmcgbG9uZyBpbnQgY29pbnNbMTAwXTsKaW50IG4sbTsKbG9uZyBsb25nIGludCBkcFsyODBdWzEwMF07Cgp2b2lkIHNvbHZlKGludCBuICxpbnQgbSkKewoKICAgIGZvcihpbnQgaT0wO2k8PW47KytpKXsKICAgICAgICBkcFswXVtpXSA9IDA7CiAgICB9CiAgICBmb3IoaW50IGk9MTtpPD1tOysraSl7CiAgICAgICAgZHBbaV1bMF0gPSAxOwoKICAgIH0KICAgIGZvcihpbnQgaWR4PTE7aWR4PD1tOysraWR4KQogICAgewogICAgICAgIGZvcihpbnQgc3VtPTE7c3VtPD1uOysrc3VtKXsKICAgICAgICAgICAgZHBbaWR4XVtzdW1dID0gZHBbaWR4LTFdW3N1bV07CiAgICAgICAgICAgIGlmKHN1bS1jb2luc1tpZHhdPDApCiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgIGRwW2lkeF1bc3VtXSArPSAgZHBbaWR4XVtzdW0tY29pbnNbaWR4XV07CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBjb3V0PDxkcFttXVtuXTsKfQoKCgoKaW50IG1haW4oKQp7CgogICAgaW50IG4sbTsKICAgIGNpbj4+bj4+bTsKICAgIGZvcihpbnQgaT0xO2k8PW07KytpKWNpbj4+Y29pbnNbaV07CgoKCiAgICBzb2x2ZShuLG0pOwoKCn0K