#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define pb push_back
#define emb emplace_back
#define lg(x) __lg(x)
#define all(s) s.begin(),s.end()
#define name "test"
#define Mask(i) (1LL<<i)
#define testbit(mask, i) ((mask >> i) & 1LL)
#define onBit(mask, i) (mask | (1LL << i))
#define offBit(mask, i) (mask & ~(1LL << i))
#define flipBit(mask, i) (mask ^ (1LL << i))
#define showbit(mask, x) bitset<x>(mask)
const ll mod = 1e9 + 7;

void add(ll &a, ll b){
     if((a += b) >= mod) a -= mod;
}


const ll inf = 1e18;
const ll lim = 1e7 + 5;
const ll N = 2e5 + 5;

int a[15];
bool check[1000005];

int d[1000005];
ll dp[1000005];
int main()
{
     ios_base::sync_with_stdio(0);
     cout.tie(0);cin.tie(0);

     int n, k; cin >> n >> k;
     for(int i = 1; i <= k; i++) cin >> a[i];

     int cnt = 1;
     for(int i = 1; i <= k; i++){
          int num = a[i];
          for(int j = 1; j <= sqrt(num); j++){
               if(num % j == 0){
                    if(check[j] == false){
                         check[j] = true;
                         d[cnt] = j;
                         cnt++;
                    }

                    if(num / j != j){
                         if(check[num / j] == false){
                              check[num / j] = true;
                              d[cnt] = num / j;
                              cnt++;
                         }
                    }
               }
          }
     }
     cnt--;
//     for(int i = 1; i <= cnt; i++) cout << d[i] << " ";

     dp[1] = 1;
     for(int i = 1; i <= n; i++){
          for(int j = 1; j <= cnt; j++){
               int jump = d[j];

               dp[i + jump] = (dp[i + jump] + dp[i]) % mod;
          }
     }

     cout << dp[n];
}










