#include using namespace std; using ll = long long; template using vt = vector; template using vvt = vector>; template using ttt = tuple; using tii = tuple; using vi = vector; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back #define mt make_tuple #define ALL(a) (a).begin(),(a).end() #define FST first #define SEC second #define DEB cerr<<"!"<0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;} inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;} /*Coding Space*/ const ll Div = 100000000000000007LL; int main(){ int n,m; cin >> n >> m; vi in(m); rep(i,m) cin >> in[i]; priority_queue, greater> q; // pos, ans q.push(tii{0,1}); ll tans = 0; while(!q.empty()){ tans = 0; ll now,ttans; tie(now, ttans) = q.top(); q.pop(); while(!q.empty() && get<0>(q.top()) == now){ ll a,b; tie(a,b) = q.top(); q.pop(); tans += b; tans %= Div; } tans += ttans; tans %= Div; if(now >= n){cout << 0 << endl; return 0;} if(now == n-1){cout << tans << endl; return 0;} //cerr << now << " " << tans << endl; for(auto dx: in) if(now + dx < n) q.push(tii{now + dx, tans}); } }