#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

template<typename T> using pb_set = gp_hash_table<T, null_type, chash>;
template<typename T, typename U> using pb_map = gp_hash_table<T, U, chash>;
pb_map<int, int> g;

void go(int x, int y) {
    if (g.find(x) == g.end()) {
        g[x] = y;
    }
    g[x] = __gcd(g[x], y);
}


void solve() {

    int N; cin >> N; 
    int A[N]; F0R(i, N) cin >> A[i];
    int lo = 2e9;
    F0R(i, N) {
        FOR(j, 1, 40000) {
            if (j * j > A[i]) break;
            if (A[i] % j == 0) {
                go(j, A[i]);
                go(A[i]/j, A[i]);
            }
        }
        ckmin(lo, A[i]);
    }

    int ans = 0;
    trav(a, g) {
        if (a.f == a.s && a.f <= lo) {
            ans++;
        }
    }
    cout << ans << nl;

}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    

    int T = 1;
//    cin >> T;
    while(T--) {
        solve();
    }

	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


#define _CRT_SECURE_NO_WARNINGS
#define FAST ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define FOR(i,a,b) for (int i=a;i<b;i++)
#define ROF(i,a,b) for (int i=b-1;i>=a;i--)
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) (v).begine(), (v).end()
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 100005;
const int mod = (int)1e9 + 7;

void mul(int& a, int b) {
	a = (ll)a * b % mod;
}

int pow(int a, int b) {
	if (b == 0)
		return 1;
	if (b % 2)
		return (ll)a * pow(a, b - 1)%mod;
	int ret = pow(a, b / 2);
	return (ll)ret * ret % mod;
}

int rev(int a) {
	return pow(a, mod - 2);
}

int main() {
	FAST;
	int n, m, tmp;
	cin >> n >> m;
	int sum = 0;
	FOR(i, 0, n) {
		cin >> tmp;
		sum += tmp;
	}
	int p = 1, q = 1;
	FOR(i, 1, sum + n + 1) {
		mul(p, m + n + 1 - i);
		mul(q, i);
	}
	q = rev(q);
	mul(p, q);
	cout << p;
}