#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)
dp[idx][sum] += 0;
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);
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmxvbmcgbG9uZyBpbnQgY29pbnNbMTAwXTsKaW50IG4sbTsKbG9uZyBsb25nIGludCBkcFsyODBdWzEwMF07Cgp2b2lkIHNvbHZlKGludCBuICxpbnQgbSkKewoKICAgIGZvcihpbnQgaT0wO2k8PW47KytpKXsKICAgICAgICBkcFswXVtpXSA9IDA7CiAgICB9CiAgCiAgICBmb3IoaW50IGk9MTtpPD1tOysraSl7CiAgICAgICAgZHBbaV1bMF0gPSAxOwoKICAgIH0KCgogICAgZm9yKGludCBpZHg9MTtpZHg8PW07KytpZHgpCiAgICB7CiAgICAgICAgZm9yKGludCBzdW09MTtzdW08PW47KytzdW0pewogICAgICAgICAgICBkcFtpZHhdW3N1bV0gPSBkcFtpZHgtMV1bc3VtXTsKICAgICAgICAgICAgaWYoc3VtLWNvaW5zW2lkeF08MCkKICAgICAgICAgICAgICAgIGRwW2lkeF1bc3VtXSArPSAwOwogICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgZHBbaWR4XVtzdW1dICs9ICBkcFtpZHhdW3N1bS1jb2luc1tpZHhdXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGNvdXQ8PGRwW21dW25dOwp9CgoKCgppbnQgbWFpbigpCnsKICAgIGludCBuLG07CiAgICBjaW4+Pm4+Pm07CiAgICBmb3IoaW50IGk9MTtpPD1tOysraSljaW4+PmNvaW5zW2ldOwoKCiAgICBzb2x2ZShuLG0pOwoKCn0K