Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the same color.Now Devu wants to select exactly s flowers from the boxes to decorate his garden. Devu would like to know, in how many different ways can he select the flowers from each box? Since this number may be very large, he asks you to find the number modulo (109 + 7). Devu considers two ways different if there is at least one box from which different number of flowers are selected in these two ways.

The first line of input contains two space-separated integers n and s (1 ≤ n ≤ 20, 0 ≤ s ≤ 1014). The second line contains n space-separated integers f1, f2, ... fn (0 ≤ fi ≤ 1012).

Output a single integer — the number of ways in which Devu can select the flowers modulo (109 + 7).

NoteSample 1. There are two ways of selecting 3 flowers: {1, 2} and {0, 3}.Sample 2. There is only one way of selecting 4 flowers: {2, 2}.Sample 3. There are three ways of selecting 5 flowers: {1, 2, 2}, {0, 3, 2}, and {1, 3, 1}.

// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG
//#pragma GCC optimize(2)

const ll MOD=1e9+7;

int n;
ll s,f[30];
ll rev;
ll ans=0;

ll pw(ll a,int k)
{
	ll b=1;
	while(k)
	{
		if(k&1) b=b*a%MOD;
		k>>=1;
		a=a*a%MOD;
	}
	return b;
}

ll C(ll a,int b)
{
	a%=MOD;
	ll tmp=1;
	for(ll i=0;i<b;i++) tmp=tmp*(a-i)%MOD;
	return tmp*rev%MOD;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	cin>>n>>s;
	for(int i=0;i<n;i++) cin>>f[i];
	ll tmp=1;
	for(int i=1;i<n;i++) tmp=(ll)tmp*i%MOD;
	rev=pw(tmp,MOD-2);
	for(int msk=0;msk<(1<<n);msk++)
	{
		int t=__builtin_popcount(msk);
		ll k=s;
		for(int i=0;i<n;i++)
			if(msk>>i&1)
				k-=f[i]+1;
		if(k<0) continue;
		if(t&1) ans=(ans-C(k+n-1,n-1)+MOD)%MOD;
		else ans=(ans+C(k+n-1,n-1))%MOD;
	}
	cout<<ans%MOD;
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

inline long long read()
{
	long long x=0; long long f=1; char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=getchar();}
	while(isdigit(ch)) {x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}

typedef long long ll;
const long long MAXN = 205;
const long long MOD = 1000000007;
ll s,n,f[MAXN];

inline ll qpow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)ans=(ans*a)%MOD;
		a=(a*a)%MOD; b>>=1;
	}
	return ans;
}

inline ll getc(ll a,ll b)
{
	if(a<b)return 0;
	if(b>a-b)b=a-b;
	ll s1=1,s2=1;
	for(ll i=0; i<b; i++)
	{
		s1=s1*(a-i)%MOD;
		s2=s2*(i+1)%MOD;
	}
	return s1*qpow(s2,MOD-2)%MOD;
}

inline ll lucas(ll x,ll k)
{
	if(k==0) return 1;
	return getc(x%MOD,k%MOD)*lucas(x/MOD,k/MOD)%MOD;
}

inline ll solve()
{
	ll ans=0;
	for(long long i=0; i<(1<<n); i++)
	{
		ll sign=1,sum=s;
		for(long long j=0; j<n; j++)
		{
			if(i&(1<<j))
				sum-=f[j]+1,sign*=-1;
		}
		if(sum<0) continue;
		ans+=sign*lucas(sum+n-1,n-1);
		ans%=MOD;
	}
	return (ans+MOD)%MOD;
}

int main(int argc, char const *argv[])
{
	n=read(); s=read();
	for(long long i=0; i<n; i++)
		f[i]=read();
	printf("%lld\n",solve());
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
#define int long long
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
int f[MAX];

int mod_pow(int base, int e){
    int ret = 1;
    while(e){
         if(e%2) ret = (ret*base)%MOD;
         base = (base*base)%MOD;
         e /= 2;
    }
    return ret;
}

int inv(int n){
    return mod_pow(n, MOD-2);
}

int C(int n, int r){
    if(n < r || r < 0 )return 0;

    int num=1,den=1;

    for(int i=n-r+1; i<=n; i++)
        num=(num*(i%MOD))%MOD;

    for(int i=1; i<=r; i++)
        den=(den*i)%MOD;

    int ret= (num*inv(den))%MOD;
    return ret;
}

 main() {
    int n, s;
    cin >> n >> s;
    int tot = 0;
    REP(i, n) {
        cin >> f[i];
        tot += f[i];
    }
    if(tot < s){
        cout <<0;
        return 0;
    }
    int ans = 0, sign = 1;
    for(int mask=0;mask<(1<<(n));mask++){
        int c = 0;
        sign = 1;
        REP(i, n){
            if(mask&(1<<i)) {
                sign *= -1;
                c += f[i]+1;
            }
        }
        c = s - c;
        if(c < 0) continue;
        ans += sign*C(c+n-1, n-1);
        ans %= MOD;
        if(ans < 0) ans += MOD;
    }

    cout << ans;
    return 0;
}

#include <iostream>
#include <ctime>
#include <string>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <queue>
#include <algorithm>
#include <cassert>
#include <sstream>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
const int inf = 1e9;
const double eps = 1e-7;

const int maxn = 25;
const ll mod = 1000000007;

ll pw(ll x, ll y)
{
	if (y == 0) return 1;
	if (y == 1) return (x % mod);

	ll ret = pw(x, y >> 1);
	ret *= ret;
	ret %= mod;

	if (y & 1) {
		ret = (ret * x) % mod;
	}

	return ret;
}

ll inv(ll n)
{
	return pw(n, mod - 2);
}

ll fac[maxn], invfac[maxn];

ll c(ll n, ll m)
{
	if (m > n) return 0;
	ll ret = 1;
	for (ll i = n - m + 1; i <= n; ++i) {
		ret = ret * (i % mod);
		ret %= mod;
	}

	ret = ret * invfac[m];
	ret %= mod;

	return ret;
}

int main()
{
#if 0
	freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
#endif
	int n; ll s;
	cin >> n >> s;
	vector<ll> f(n);
	for (int i = 0; i < n; ++i) {
		cin >> f[i];
	}

	fac[0] = 1; invfac[0] = inv(fac[0]);
	for (int i = 1; i <= n; ++i) {
		fac[i] = (fac[i - 1] * i) % mod;
		invfac[i] = inv(fac[i]);
		//cout << fac[i] << ' ' << invfac[i] << endl;
	}

	ll res = 0;
	for (int mask = 0; mask < (1 << n); ++mask) {
		int bcount = 0;
		ll cur = s;
		for (int bit = 0; bit < n; bit++) {
			if (mask & (1 << bit)) {
				bcount++;
				cur -= f[bit] + 1;
			}
		}
		if (cur >= 0) {
			ll cc = c(cur + n - 1, n - 1);
			if (bcount & 1) res -= cc;
			else res += cc;
			res %= mod;

			//cout << mask << ' ' << cc << endl;
		}
	}

	res = (res + mod) % mod;
	cout << res;

	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int mod = 1000000007;
long long a[22], m, ans = 0;
int inv[22], n;

// a^b
int power(int a, int b) {
	int c = 1;
	for (; b; b>>=1) {
		if (b&1) c = (long long)c * a % mod;
		a = (long long)a * a % mod;
	}
	return c;
}

// C(y,x)
int C(long long y, int x) {
	if (y < 0 || x < 0 || y < x) return 0;
	y %= mod;
	if (y == 0 || x == 0) return 1;
	int ans = 1;
	for (int i = 0; i < x; i++)
		ans = (long long)ans * (y - i) % mod;
	for (int i = 1; i <= x; i++)
		ans = (long long)ans * inv[i] % mod;
	return ans;
}

int main() {
	for (int i = 1; i <= 20; i++)
		inv[i] = power(i, mod-2);
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int x = 0; x < 1<<n; x++) {
		if (x == 0) {
			ans = (ans + C(n+m-1, n-1)) % mod;
		}
		else {
			long long t = n + m;
			int p = 0;
			for (int i = 0; i < n; i++)
				if (x >> i & 1) {
					p++;
					t -= a[i + 1];
				}
			t -= p+1;
			if (p&1) {
				ans = (ans - C(t, n-1)) % mod;
			}
			else {
				ans = (ans + C(t, n-1)) % mod;
			}
		}
	}
	cout << (ans + mod) % mod << endl;
}

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
typedef long long LL;
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define vi vector<long long>
#define vbool vector<bool>
#define mod 1000000007
using namespace std;
long long n,s;
/*
vi factors;

void init() {
    factors.resize(mod);
    factors[0] = 1;
    factors[1] = 1;
    for(long long i = 2;i<factors.size();i++){
        factors[i] = (i * factors[i-1])%mod;
    }
}

long long modBinomial(long long n,long long r){
    long long that = (factors[n]);
    long long other = pow((factors[r] * factors[n-r]),mod-2);
    other = other % mod;
    return (that * other) % mod;
}

long long modPow(long long a, long long x, long long p) {
    //calculates a^x mod p in logarithmic time.
    long long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

long long modInverse(long long a, long long p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}
long long modBinomial(long long n, long long k, long long p) {
// calculates C(n,k) mod p (assuming p is prime).

    long long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (long long i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    long long denominator = 1; // k!
    for (long long i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
*/

LL f[22], inv[55];

LL nCr(LL n, LL r) {
      if (r > n) return 0;
      if (n - r < r) r = n - r;
      n %= mod;
      LL ans = 1;
      REP(i, r) {
            ans = (ans * (n - i)) % mod;
            ans = (ans * inv[i + 1]) % mod;
      }
      return ans;
}

LL modpow(LL a, LL b) {
      LL res = 1;
      while (b) {
            if (b & 1) res = (res * a) % mod;
            a = (a * a) % mod;
            b >>= 1;
      }
      return res;
}

void pre() {
      for (int i = 1; i <= 50; i++) {
            inv[i] = modpow(i, mod - 2);
      }
}

long long ans = 0;
vi used;
vi values;
long long rec(long long now){
    if(now >= n){
        //check
        long long use = 0;
        long long new_s = s;
        for(long long i = 0;i<n;i++){
            if(used[i] == 1){
                new_s-=(values[i]+1);
                use++;
            }
        }

        long long sum;
        if(new_s < 0)
            return 0;
        else
            sum = nCr((new_s+n-1),n-1);
        if(use % 2 == 1)
            sum = -sum;
        sum = (sum + mod)%mod;
        if(sum < 0) sum += mod;
        return sum;
    }
    else{
        long long b = 0;
        used[now] = 1;
        b = (b+rec(now+1))%mod;
        used[now] = 0;
        b = (b+rec(now+1))%mod;
        return b;
    }
}
int main()
{
    pre();
    cin >> n >> s;
    used.resize(n);
    values.resize(n);
    for(long long i = 0;i<n;i++) cin >> values[i];
    cout << rec(0) << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
ll a[25],tr=1,hell=pow(10,9)+7;
ll exp(ll x,ll y){
	ll res=1;
	x%=hell;
	while(y){
		if(y&1)
			res=(res*x)%hell;
		y>>=1;
		x=(x*x)%hell;
	}
	return res;
}
ll bin(ll n,ll r){
	ll res=tr;
	for(ll i=n;i>n-r;i--){
		ll val=i%hell;
		res=(res*val)%hell;
	}
	return res;
}
ll add(ll x,ll y){
	x+=y;
	if(x>=hell)
		x-=hell;
	return x;
}
ll sub(ll x,ll y){
	x-=y;
	if(x<0)
		x+=hell;
	return x;
}
void solve(){
	ll n,s;
	cin>>n>>s;
	for(ll i=1;i<=n-1;i++)
		tr=(tr*i)%hell;
	tr=exp(tr,hell-2);
	for(ll i=0;i<n;i++){
		cin>>a[i];
		a[i]++;
	}
	ll val=pow(2,n),res=0;
	for(ll i=1;i<val;i++){
		ll x=i,sum=s,c=0,cnt=0;
		while(x){
			if(x&1){
				sum-=a[c];
				cnt++;
			}
			x>>=1;
			c++;
		}
		if(sum>=0){
			if(cnt&1)
				res=sub(res,bin(sum+n-1,n-1));
			else
				res=add(res,bin(sum+n-1,n-1));
		}
	}
	res=add(res,bin(s+n-1,n-1));
	cout<<res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}

#include <iostream>
#include <cstdio>
using namespace std;

typedef long long ll;
const int mod = 1e9 + 7;

ll a[25], inv[25];

ll power(ll a, ll b)
{
    ll res = 1;
    for (; b; b >>= 1)
    {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}

ll C(ll y, ll x)
{
    if (x < 0 || y < 0 || x > y)
        return 0;
    y %= mod;
    if (x == 0 || y == 0)
        return 1;
    ll res = 1;
    for (int i = 1; i <= x; i++)
    {
        res = res * (y - i + 1) % mod;
        res = res * inv[i] % mod;
    }
    return res;
}

int main()
{
    ll n, m, ans;
    for (int i = 1; i <= 20; i++)
        inv[i] = power(i, mod - 2);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    ans = C(n + m - 1, n - 1);
    for (int x = 1; x < (1 << n); x++)
    {
        int p = 0;
        ll t = n + m;
        for (int i = 0; i < n; i++)
            if (x >> i & 1)
            {
                p++;
                t -= a[i + 1];
            }
        t -= (p + 1);
        t = C(t, n - 1);
        if (p & 1)
            ans = (ans - t) % mod;
        else
            ans = (ans + t) % mod;
    }
    cout << (ans + mod) % mod << endl;
    return 0;
}

#include <iostream>

using namespace std;

typedef long long ll;

const int N = 25;
const int MOD = 1000000007;

ll n, s, f[N];

ll qPow(ll a, ll k, ll p)
{
	ll ans = 1;
	while (k) {
		if (k & 1) ans = (ans * a) % p;
		a = (a * a) % p, k /= 2;
	}
	return ans;
}

ll C(ll a, ll b, ll p)
{
	if (a < b) return 0;
	if (b > a - b) b = a - b;
	ll up = 1, down = 1;
	for (ll i = 0; i < b; i++) {
		up = up * (a - i) % p;
		down = down * (i + 1) % p;
	}
	return up * qPow(down, p - 2, p) % p;
}

ll Lucas(ll a, ll b, ll p) {
	if (b == 0) return 1;
	return C(a%p, b%p, p) * Lucas(a / p, b / p, p) % p;
}

ll solve()
{
	ll res = 0;
	// 用二进制暴力循环2^n中选择
	// 1表示这一朵花超过了，0表示没有超过
	for (int i = 0; i < (1 << n); i++) {
		ll t = s, sign = 1;
		for (int j = 0; j < n; j++) {
			// 第j个人是否超过
			// 当只有i的二进制的第j位是1时，i & (1 << j)才不等于0
			if (i & (1 << j)) t -= (f[j] + 1), sign *= -1;
		}
		if (t < 0) continue;
		res = (res % MOD + sign * Lucas(t + n - 1, n - 1, MOD)) % MOD;
	}
	return (res + MOD) % MOD;
}

int main()
{
	cin >> n >> s;
	for (int i = 0; i < n; i++) cin >> f[i];
	cout << solve() << endl;
	//system("pause");
	return 0;
}

#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
typedef __int64 LL;
typedef pair<int, int> PII;
#define mp          make_pair
#define pb          push_back
#define FIN         freopen("C:\\Users\\Administrator\\Desktop\\Code\\in.txt", "r", stdin)
#define FOUT        freopen("C:\\Users\\Administrator\\Desktop\\Code\\out.txt", "w", stdout)
#define lson        l, mid, cur << 1
#define rson        mid + 1, r, cur << 1 | 1
#define debug       puts("-------------");
#define lowbit(x)   ((x)&(-(x)))
//#pragma comment(linker, "/STACK:1024000000,1024000000")
const int INF = 0x3f3f3f3f;
const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-8;
const int MOD = 1e9 + 7;
const int MAXN = 1e3 + 50;
const int MAXM = 2e4 + 50;

int n;
LL s, f[MAXN];

LL inv(LL x) {
    return x == 1 ? 1 : (MOD - MOD / x) * inv(MOD % x) % MOD;
}
LL C(LL a, LL b) {
    if (a < b || a < 0 || b < 0) return 0;
    a %= MOD;
    LL res = 1;
    for (int i = 1; i <= b; i++)
        res = (res * (a + 1 - i) % MOD) * inv(i) % MOD;
    return res;
}

int main() {
#ifdef LOCAL_NORTH
    FIN;
#endif // LOCAL_NORTH
    while (~scanf("%d%I64d", &n, &s)) {
        for (int i = 0; i < n; i++)
            scanf("%I64d", &f[i]);
        LL ans = 0;
        for (int k = 0; k < (1 << n); k++) {
            LL tmp = 0;
            int t = k, p = 0;
            while (t) {
                if (t & 1)
                    tmp += f[p] + 1;
                p++;
                t >>= 1;
            }
            ans = (ans + (__builtin_popcount(k) & 1 ? -1 : 1) * C(s - tmp + n - 1, n - 1) + MOD) % MOD;
        }
        printf("%I64d\n", ans);
    }
#ifdef LOCAL_NORTH
    cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC * 1000 << " ms." << endl;
#endif // LOCAL_NORTH
    return 0;
}

#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<cstdio>
#include<queue>
#include<sstream>
#include<list>
#include<bitset>
#include<ctime>
using namespace std;

typedef long long Int;
#define FOR(i,a,b) for(int i=(a); i<=(b);++i)
#define mp make_pair
#define pb push_back
#define sz(s) (int)((s).size())
const int inf = 1000000000;
const int MOD = 1000000007;
const double pi=acos(-1.0);

Int f[22];
int n;

Int binpw(Int x, int times) {
	Int ans=1;
	while(times) {
		if(times&1) ans=ans*x % MOD;
		x=x*x%MOD;
		times/=2;
	}
	return ans;
}

Int fact[33], ifact[33];

Int get(Int s) {
	Int ans=1;
	Int j=(s+1)%MOD;
	for(Int i=s+1; i<s+n; ++i) {
		if(i%MOD==0) return 0;
		ans=ans*j % MOD;
		++j;
	}
	ans=ans*ifact[n-1] % MOD;
	return ans;
}

int main() {
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	//freopen("magic.in","r",stdin);freopen("magic.out","w",stdout);
	fact[0]=ifact[0]=1;
	FOR(i,1,22) {
		fact[i]=i*fact[i-1] % MOD;
		ifact[i]=binpw(fact[i], MOD-2);
	}

	Int s;
	cin>>n>>s;
	FOR(i,0,n-1) cin>>f[i];

	Int ans=0;
	FOR(mask,0,(1<<n)-1) {
		int bits=0;
		int m=mask;
		while(m) {
			bits+=m%2;
			m/=2;
		}

		Int ss=s;
		FOR(i,0,n-1) if(mask&(1<<i)) ss-=f[i]+1;
		if(ss<0) continue;

		if(bits%2==0) {
			ans+=get(ss);
			if(ans>=MOD) ans-=MOD;
		}else {
			ans-=get(ss);
			if(ans<0) ans+=MOD;
		}
	}

	cout<<ans<<endl;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 20 + 3, MOD = 1e9 + 7;

typedef long long ll;

#define int ll

int a[N];
int n, s, ans;

int GCD(int a, int b) {
    return (b ? GCD(b, a % b) : a);
}

inline int mul(int a, int b) {
    a %= MOD;
    b %= MOD;
    return (1LL * a * b) % MOD;
}

inline int sum (int a, int b) {
    a += b;
    if (a >= MOD)
	a -= MOD;
    return a;
}

inline int stb(int a, int b) {
    a -= b;
    if (a < 0)
	a += MOD;
    return a;
}

int power(int a, int p) {
    int res = 1;
    for (; p; p /= 2) {
	if (p % 2)
	    res = mul(res, a);
	a = mul(a, a);
    }
    return res;
}

inline int c(int k, int n) {
    int up = 1, down = 1;
    for (int i = n; i > n - k; i--)
	up = mul(up, i);
    for (int i = 1; i <= k; i++)
	down = mul(down, i);
    return mul(up, power(down, MOD - 2));
}

int32_t main() {
    cin >> n >> s;
    for (int i = 0; i < n; i++)
	cin >> a[i];
    for (int mask = 0; mask < (1 << n); mask++) {
	int cnt = s;
	for (int i = 0; i < n; i++) {
	    if ((mask >> i) & 1) {
		cnt -= a[i] + 1;
	    }
	}
	if (cnt < 0)
	    continue;
	int tmp = c(n - 1, cnt + n - 1);
        if (__builtin_popcount(mask) % 2)
	    ans = stb(ans, tmp);
	else
	    ans = sum(ans, tmp);
    }
    return cout << ans, 0;
}

#include <bits/stdc++.h>
#define For(i, a, b) for(register int i = (a); i <= (b); ++i)
#define Rof(i, a, b) for(register int i = (a); i >= (b); --i)
#define INF 0x3f3f3f3f
#define LL long long
#define Mod 1000000007
using namespace std;
int N;
LL A[21], M, Ans, Inv[21], Pos = 1;
LL Pow(LL a, int k) {
	LL Ret = 1;
	for(;k ; k >>= 1, a = a * a % Mod) if(k & 1) Ret = Ret * a % Mod;
	return Ret;
}
LL C(LL x, int y) {
	if(x < 0 || y < 0 || x < y) return 0;
	if(x == y || y == 0) return 1;
	x %= Mod;
	LL Ret = 1;
	For(i, 0, y - 1) Ret = Ret * (x - i) % Mod;
	return Ret * Pos % Mod;
}
int main() {
	scanf("%d%lld", &N, &M); For(i, 1, N) scanf("%lld", &A[i]);
	For(i, 1, N - 1) Inv[i] = Pow(i, Mod - 2), Pos = Pos * Inv[i] % Mod;
	Ans = C(N + M - 1, N - 1);
	For(Sta, 1, Pow(2, N) - 1) {
		LL t = 1, k = 0;
		For(i, 1, N) if(Sta >> (i - 1) & 1) t += 1 + A[i], ++k;
		if(k & 1) Ans = (Ans - C(N + M - t, N - 1)) % Mod;
		else Ans = (Ans + C(N + M - t, N - 1)) % Mod;
	}
	printf("%lld\n", (Ans + Mod) % Mod);
	return 0;
}

#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 20;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n;
ll s, f[N];
ll powmod(ll a, ll b)
{
	ll ans = 1;
	while(b)
	{
		if(b&1) ans = ans*a%mod;
		a = a*a%mod;
		b >>= 1;
	}
	return ans;
}
ll comp(ll a,ll b)
{
	if(a<0||b<0) return 0;
	if(a<b) return 0;
	if(b>a-b) b = a - b;
	ll ca = 1, cb = 1;
	for(int i=0;i<b;i++)
	{
		ca = ca*(a-i)%mod;
		cb = cb*(b-i)%mod;
	}
	return ca*powmod(cb,mod-2)%mod;
}
ll lucas(ll n, ll m)
{
	if(n<0) return 0;
	if(!m) return 1;
	return comp(n%mod, m%mod)*lucas(n/mod, m/mod)%mod;
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> s;
 	for(int i=0; i<n; i++) cin >> f[i];
 	ll ans = 0;
 	for(int i=0; i<(1<<n); i++)
 	{
 		int parity = 0;
 		ll d = n - 1 + s;
 		for(int j=0; j<n; j++)
 		{
 			if((i>>j)&1)
 			{
 				parity++;
 				d -= f[j];
 			}
 		}
 		//debug(d-parity); debug(n-1);
 		ll cur = lucas(d-parity, n-1);
 		//debug(cur);
		if(parity&1) ans = (ans - cur + mod)%mod;
		else ans = (ans + cur)%mod;
	}
	ans = (ans + mod)%mod;
	cout << ans;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ALL(c) c.begin(), c.end()
#define SZ(x) ((int)(x).size())
#define MP make_pair

#define DB(x) cerr << __LINE__ << ": " << #x << " = " << x << endl;
#define LEFT(x) 2*x+1
#define RIGHT(x) 2*x+2

typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> point;
typedef vector<point> polygon;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int INF = 1 << 30;
const double EPS = 1e-7;

/*
  UH++
  Universidad de La Habana
*/
const int MAXN = 30;
const int MOD = 1000000007;
int64 f[MAXN];
int64 inv[MAXN];

int N;
int64 S;

int64 modpow(int64 x, int64 p)
{
	if(p == 0) return 1;
	if(p%2) return (modpow((x*x) % MOD, p/2) * x) % MOD;
	return modpow((x*x) % MOD,p/2);
}

int64 inverse(int64 x)
{
	return modpow(x, MOD-2);
}

int64 comb(int64 n, int64 k)
{
	if(n < k) return 0;
	int64 ans = 1;
	for(int64 i = n-k+1; i <= n; i++)
		ans = ( (i % MOD) * ans) % MOD;
	for(int64 i = 2; i <= k; i++)
		ans = (ans * inv[i]) % MOD;
	return ans;
}

int64 solve(int m)
{
	int64 w = 0;
	for(int i = 0; i < N; i++)
	{
		if(m & (1 << i))
			w += (f[i]+1);
	}
	if(w > S) return 0;
	return comb(S - w + N-1, N-1);
}

int64 solve()
{
	int64 ans = 0;
	for(int i = 1; i < (1 << N); i++)
	{
		if(__builtin_popcount(i) % 2) ans  = (ans + solve(i)) % MOD;
		else ans = (ans - solve(i) + MOD) % MOD;
	}
	return (comb(S + N - 1,N - 1) - ans + MOD) % MOD;
}

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

	cin >> N >> S;

	for(int i = 1; i <= N; i++)
		inv[i] = inverse(i);

	for(int i = 0; i < N; i++)
		cin >> f[i];

	cout << solve() << endl;

    return 0;
}

#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int mod = 1e9 + 7, maxn = 1e5 + 5;

int fact[maxn], ifact[maxn];
int N;
ll a[maxn], sum;

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

int power(int a, int b)
{
  if(b == 0) return 1;
  int res = power(a, b / 2);
  if(b & 1) return 1ll * res * res % mod * a % mod;
  return 1ll * res * res % mod;
}

int C(int k, ll n)
{
  if(k > n) return 0;
  int res = 1;
  for(ll i = n - k + 1; i <= n; ++i)
    res = 1ll * res * (i % mod) % mod;
  res = 1ll * res * ifact[k] % mod;
  return res;
}

int euler(ll k, int n)/// chia k keo cho n nguoi
{
  return C(n - 1, k - 1);
}

void prep(void)
{
  fact[0] = 1;
  for(int i = 1; i < maxn; ++i)
    fact[i] = 1ll * i * fact[i - 1] % mod;
  ifact[maxn - 1] = power(fact[maxn - 1], mod - 2);
  for(int i = maxn - 2; i >= 0; --i)
    ifact[i] = 1ll * ifact[i + 1] * (i + 1) % mod;
}

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL
  prep();
  cin >> N >> sum;
  for(int i = 0; i < N; ++i) cin >> a[i];
  int res = 0;
  for(int mask = 0; mask < (1 << N); ++mask){
    ll tmp = sum;
    for(int i = 0; i < N; ++i){
      if(mask >> i & 1){
        tmp -= a[i] + 1;
      }
    }
    if(tmp < 0) continue;
    int way = euler(tmp + N, N);
    #ifdef LOCAL
    for(int i = 0; i < N; ++i)
      cerr << (mask >> i & 1); cerr << ' ';
    cerr << way << '\n';
    #endif // LOCAL
    if(__builtin_popcount(mask) & 1) add(res, -way);
    else add(res, way);
  }
  cout << res;
}

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")

//#pragma comment(linker,"/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)
//logb(n)=loga(n)/loga(b)

#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) (ll)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0
// a^b=(a+b)-2(a&b)

typedef double db;
typedef long long ll;

const int ary=2e2+5;
const int mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
int n;
ll s,f[25],ans,p=1;
ll binpow(ll a,ll b){
	if(!b){
		return 1;
	}
	if(b%2){
		return binpow(a,b-1)*a%mod;
	}
	ll t=binpow(a,b/2);
	return t*t%mod;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>s;
	for(int i=1;i<n;i++){
		p=p*i;
		p%=mod;
	}
	p=binpow(p,mod-2);
	for(int i=1;i<=n;i++){
		cin>>f[i];
	}
	for(int mask=0;mask<(1<<n);mask++){
		ll sum=0;
		int cnt=0;
		for(int i=0;i<n;i++){
			if(mask&(1<<i)){
				sum+=f[i+1]+1;
				cnt++;
			}
		}
		ll x=p;
		if(n+s-sum-1<n-1){
			x=0;
		}
		for(ll i=n+s-sum-1;i>=s-sum+1;i--){
			x*=(i%mod);
			x%=mod;
		}
		if(cnt%2){
			ans-=x;
		}
		else{
			ans+=x;
		}
		ans+=mod;
		ans%=mod;
	}
	cout<<ans;
}

#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#define sf scanf
#define pf printf
#define ll long long
using namespace std;
struct point
{
    ll x,y;
    point(){}
    point(ll a,ll b):x(a),y(b){}
};
point a[2000000];
int n,tot;
ll s;
const int mod = 1e9 + 7;
ll k1,k2,f[22];
inline bool cmp(point a,point b)
{
    return a.x < b.x;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y)
{
    if (b == 0)
    {
        x = 1; y = 0;
        return a;
    }
    ll r = extend_gcd(b,a % b,y,x);
    y -= x * (a / b);
    return r;
}
inline ll NI(ll x)
{
    k1 = k2 = 0;
    extend_gcd(x,mod,k1,k2);
    return (k1 % mod + mod) % mod;
}
inline ll C(ll n,ll m)
{
    ll ans = 1;
    for (ll i = n; i >= n - m + 1; i--) ans = (ans * (i % mod)) % mod;
    for (ll i = 2; i <= m; i++) ans = (ans * NI(i)) % mod;
    return (ans % mod + mod) % mod;
}
int main()
{
    cin>>n>>s;
    for (int i = 1; i <= n; i++)
    {
        cin>>f[i];
        f[i]++;
    }
    tot = 2;
    a[1].x = f[1]; a[1].y = -1;
    a[2].x = 0; a[2].y = 1;
    for (int i = 2; i <= n; i++)
    {
        int tmp = tot;
        for (int j = 1; j <= tmp; j++)
        {
            ll x = a[j].x + f[i],y = -a[j].y;
            a[++tot] = point(x,y);
        }
    }
    //cout<<tot<<endl;
    ll ans = 0;

    for (int i = 1; i <= tot; i++)
    {
        ll r = s - a[i].x;
        if (r < 0) continue;
        ll tmp = C(r + n - 1,n - 1) % mod;
        ans = (ans + (tmp * a[i].y) % mod) % mod;
    }
    ans = (ans  % mod + mod) % mod;
    pf("%I64d\n",ans);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long

const ll mod = 1e9 + 7;
ll fact[103];

void precalc()
{
	fact[0] = fact[1] = 1;
	for(ll i = 2; i < 103; i ++)
		fact[i] = (i * fact[i - 1]) % mod;
}

ll mpe(ll base, ll expo)
{
	ll ans = 1;
	while(expo)
	{
		if(expo & 1)
			ans = (ans * base) % mod;
		base = (base * base) % mod;
		expo >>= 1;
	}
	return ans;
}

ll func(ll n)
{
	ll ans = 0;
	while(n >= mod)
	{
		ans += n / mod;
		n /= mod;
	}
	return ans;
}

ll calc(ll n, ll k)
{
	if(func(n) > func(k) + func(n - k))
		return 0;
	ll ans = 1, i;
	for(i = n - k + 1; i <= n; i ++)
		ans = ((ans % mod) * (i % mod)) % mod;
	ans = ((ans % mod) * mpe(fact[k], mod - 2)) % mod;
	return ans;
}

int main()
{
	ll n, s, f, i, j, res = 0, temp, cnt, rp;
	vector<ll> v;
	cin >> n >> s;
	for(i = 1; i <= n; i ++)
	{
		cin >> f;
		v.push_back(f);
	}
	precalc();
	for(i = 0; i < (1 << n); i ++)
	{
		temp = s;
		cnt = 0;
		for(j = 0; j < n; j ++)
		{
			if(i & (1 << j))
			{
				temp -= v[j] + 1;
				cnt ++;
			}
		}
		if(temp < 0)
			continue;
		rp = calc(temp + n - 1, n - 1);
		if(cnt & 1)
			rp *= -1;
		res = (res + rp) % mod;
		res = (res + mod) % mod;
	}
	cout << res;
}

#include <bits/stdc++.h>
using namespace std;
#pragma optimize("-O3")
#define int long long int
#define pb push_back
#define pb push_back
const int N=1000000007;

int n, s;

int add(int x, int y)
{
	return (x + y) % N;
}

int sub(int x, int y)
{
	return add(x, N - y);
}

int mul(int x, int y)
{
	return (x * 1ll * y) % N;
}

int binpow(int x, int y)
{
	int z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}

int inv(int x)
{
	return binpow(x, N - 2);
}
int invc[25];
int C(int nn, int rr){
	int ans=1;
	if(rr>nn || rr<0){
		return 0;
	}
	if(rr==0 || rr==nn){
		return 1;
	}
	for(int i=rr+1; i<=nn; i++){
		ans=(ans*(i%N))%N;
	}

	for(int i=n-1; i>=1; i--){
		ans=(ans*(invc[i]))%N;
	}

	return ans;
}
main() {
	for(int i=1; i<=21; i++){
		invc[i]=inv(i);
	}
	cin>>n>>s;
	int arr[n];
	int sum=0;
	for(int i=0; i<n; i++){
		cin>>arr[i];
		sum+=arr[i];
	}
	if(sum<s){
		cout<<0;
		return 0;
	}
	int ans=0;
	for(int i=0; i<(1<<n); i++){
		int nums=__builtin_popcount(i);
		int sum=0;
		for(int j=0; j<n; j++){
			if(((1<<j)&i)==(1<<j)){
				sum+=(arr[j]+1);
			}
		}
		if(nums%2==0){
			int req=s-sum;
			ans=(ans+(((C(n+req-1, req))%N)+N))%N;

		}
		else{
			int req=s-sum;
			ans=(((ans-C(n+req-1, req))%N)+N)%N;

		}
	}
	cout<<ans;
	return 0;
}

/* Author : RISHAV GOYAL */

#include <bits/stdc++.h>
using namespace std;

#define LL long long int
#define UL unsigned long long int

#define imax INT_MAX
#define imin INT_MIN
#define LLmax LLONG_MAX
#define LLmin LLONG_MIN

#define FOR(i,a,b) for(int i= (int)a; i<= (int)b; i++)
#define rep(i,n) for(int i= int(1); i<= (int)n; i++)
#define FORd(i,a,b,d) for(int i=(int)a; i<= (int)b; i+=(int)d)

#define pr() printf("Reached here 1...\n");
#define pr1() printf("Reached here 2...\n");

#define CLR(a) memset(a,0,sizeof(a));
#define SET(a) memset(a,-1,sizeof(a));

#define str strlen
#define pb(x) push_back(x)
#define mp make_pair
#define ii pair<int,int>
#define ll pair<LL,LL>

#define F first
#define S second
#define gcd(a,b) __gcd(a,b)

#define mod int(1e9 + 7)
#define MAX int(1e5 + 10)

#define si(a) scanf("%d",&a);

#define VI vector<int>
#define VL vector<LL>
#define VS vector<string>
#define VC vector<char>

LL powmod(LL a,int b,int n){LL rm=1;while (b){if (b % 2) { rm = (rm * a) % n; }a = (a * a) % n;b /= 2;}return rm;}

int n;
LL s,f[30],ans=0,invf;

LL ncr(LL nn,LL k){

	if( nn<k) return 0;
	LL mul = 1,limit = nn - k;
	//	cout << nn << " " << k << endl;
	for(LL st = limit+1; st <= nn;st++){
		mul = ( mul * (st%mod) ) % mod;
	}
	mul = ( mul * invf) % mod;
	return mul;
}

void process(int mask){
	int bitcount = 0;
	LL sum = 0;
	for(int i=0;i<n;++i){
		if( mask & (1<<i)){
			sum += f[i+1] +1;
			bitcount++;
		}
	}
	if(bitcount%2==0) ans += ncr( n + (s - sum)-1, n-1 );
	else ans -= ncr( n + (s - sum)-1, n-1);
	//	cout << ans << endl;
	ans %= mod;
	ans += mod;
	ans %= mod;
}

int main()
{

	cin >> n >> s;
	rep(i,n) cin >> f[i];
	LL m = 1;
	for(LL i=2;i<n;++i){
		m = m * powmod(i,mod-2,mod);
		m %= mod;
	}

	invf = m;

	for(int i=0; i<(1<<n);++i){
		process(i);
	}

	cout << ans << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")

const long long maxn = 21;
const long long mod = 1e9 + 7;

long long ans;
long long n, s;
long long a[maxn];
long long inverse[maxn];
long long sum[1 << maxn];

void in();
void solve();
void out();
long long pwr(long long, long long);
long long C(long long, long long);

int main(){
    in();
    solve();
    out();
}

void in(){
    ios::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    cin >> n >> s;
    for(long long i = 0; i < n; i++){
        cin >> a[i];
        a[i]++;
    }
}

void solve(){
    for(int i = 1; i <= 20; i++)
        inverse[i] = pwr(i, -1);
    for(long long i = 1; i < (1 << n); i++){
        sum[i] = sum[i - (i & -i)];
        sum[i] += a[__builtin_ctz(i)];
    }
    for(long long i = 0; i < (1 << n); i++){
        ans += (-2 * (__builtin_popcount(i) % 2) + 1) * C(s + n - 1 - sum[i], n - 1);
        ans += mod;
        ans %= mod;
    }
}

void out(){
    cout << ans;
}

long long pwr(long long a, long long b){
    if(b == 0)
        return 1;
    if(b < 0)
        return pwr(a, b + mod - 1);
    long long c = pwr(a, b / 2);
    if(b % 2)
        return c * c % mod * a % mod;
    return c * c % mod;
}

long long C(long long n, long long k){
    if(n < k)
        return 0;
    long long ans = 1;
    for(long long i = 1; i <= k; i++){
        ans *= inverse[i];
        ans %= mod;
        ans *= (n - i + 1) % mod;
        ans %= mod;
    }
    return ans;
}

// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890123456780LL
#define patkan 9
#define tisic 47
#define soclose 1e-7
#define pi 3.1415926535898
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
#define uint unsigned int
#include <time.h>
// mylittlepony
using namespace std;

long long mod =1000000007;
long long fac[1000000];
long long facS[1000000];

long long pw(long long a, long long e) {
	if(e <= 0) return 1;
	long long x =pw(a,e/2);
	x =(x*x)%mod;
	if(e%2 != 0) x =(x*a)%mod;
	return x;}

long long cnt(long long K, long long N) {
	// sucin K+1..K+N-1
	if((K+N-1)%mod != (K%mod)+N-1) return 0;
	K =(K+1)%mod;
	long long ret =1;
	for(int i =0; i < N-1; i++) ret =(ret*(K+i))%mod;
	return ret;}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	fac[0] =1;
	for(int i =1; i < 1000000; i++) fac[i] =(i*fac[i-1])%mod;
/*	long long F =1;
	for(int i =0; i < mod; i++) {
		if(i%2000 == 0) facS[i/2000] =F;
		F =((i+1)*F)%mod;}
*/	int N;
	long long S, ans =0;
	cin >> N >> S;
	long long inv =pw(fac[N-1],mod-2);
	vector<long long> A(N);
	for(int i =0; i < N; i++) cin >> A[i];
	for(int i =0; i < (1<<N); i++) {
		long long s =0;
		int x =0;
		for(int j =0; j < N; j++) {
			s +=((i>>j)&1)*(A[j]+1);
			x +=(i>>j)&1;}
		if(s > S) continue;
		if(x%2 == 0) ans +=(inv*cnt(S-s,N))%mod;
		else ans -=(inv*cnt(S-s,N))%mod;}
	ans %=mod;
	if(ans < 0) ans +=mod;
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define MP make_pair
#define X first
#define Y second
#define M 1115004
#define N 50010
#define mod 1000000007

#define LL long long

LL a[22];
int rbit[M];
LL fpow( LL a, int n )
{
	LL ans = 1;
	while( n ){
		if( n & 1 ) ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
LL C( LL n, LL m )
{
	if( m > n ) return 0;
	LL ans = 1;
	LL tmp = 1;
	for( int i = 0; i < m; ++i ){
		ans = ( n - i ) % mod * ans % mod;
		tmp = tmp * ( i + 1 ) % mod;
	}
	ans = ans * fpow( tmp, mod - 2 ) % mod;
	return ans;
}
LL s[M], S;
int cnt[M];

int main()
{
	int n;
	cin>>n>>S;
	LL ans = 0;
	for( int i = 0; i < n; ++i ) rbit[1<<i] = i;
	for( int i = 0; i < n; ++i ) cin>>a[i];
	for( int i = 0; i < ( 1 << n ); ++i ){
		int c = 1;
		LL s = 0;
		int j = i, x;
		while( j ){
			x = j & -j;
			s += a[rbit[x]] + 1;
			c *= -1;
			j -= x;
		}
		ans = ( ans + c * C( S - s + n - 1, n - 1 ) ) % mod;
	}
	if( ans < 0 ) ans += mod;
	cout<<ans<<endl;
}

#include"bits/stdc++.h"
#define debug(x) cout<<#x<<" = "<<x<<"  ";
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int MX = 3e5+17;
const int mod = 1e9+7;
int n;
LL f[22];
LL inv[22];
void init()
{
    inv[0] = inv[1] = 1;
    for(int i = 2; i <= 20; i++) inv[i] = (mod-mod/i)*inv[mod%i]%mod;
}

LL C(LL n, LL m)
{
    if(n < m) return 0;
    if(m > n-m) m = n-m;
    LL ret = 1;
    for(int i = 1; i <= m; i++)
        ret = ret*((n-i+1)%mod)%mod *inv[i]%mod;
    return ret;
}

LL dfs(int dep, LL s, bool parity)
{
    if(s < 0) return 0;
    if(dep == n){
        LL ret = C(s+n-1,n-1);
        return parity? -ret : ret;
    }
    LL ans = dfs(dep+1,s,parity);
    ans += dfs(dep+1,s-f[dep+1]-1,!parity);
    return (ans+mod)%mod;
}

void solve()
{
    LL s, sum = 0;
    scanf("%d%I64d",&n,&s);
    for(int i = 1; i <= n; i++)
        scanf("%I64d",&f[i]), sum += f[i];
    if(sum < s){
        printf("0");
        return;
    }
    LL ans = dfs(0,s,0);
    printf("%I64d\n",ans);
}

int main()
{
    init();
    int n,m,K,T,cas = 0;
    solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

template<typename T>
inline void read(T&x) {
	x = 0; bool w = 1; char c = getchar();
	while(!isdigit(c)) { if(c=='-')w=0; c = getchar(); }
	while(isdigit(c)) { x = x*10+c-'0'; c = getchar(); }
	x = w ? x : -x;
}

typedef long long i64;
const int N = 22, Mod = 1e9 + 7;
int n, fac[N], inv[N], siz[1<<N];
i64 A[N], val[1<<N], m;

inline int power(int a, int b) { int c = 1;
	for(; b; b >>= 1, a = 1ll * a * a % Mod)
		if(b & 1) c = 1ll * a * c % Mod;
	return c;
}

inline void pre() {
	for(int i = 0; i < 1 << n; i++) { val[i] = m + n - 1;
		for(int j = 0; j < n; j++)
			if(i>>j&1) val[i] -= A[j+1] + 1, siz[i] += 1;
	}
	fac[0] = 1; for(int i = 1; i <= n; i++) fac[i] = 1ll * fac[i-1] * i % Mod;
	inv[n] = power(fac[n], Mod - 2);
	for(int i = n; i; i--) inv[i-1] = 1ll * inv[i] * i % Mod;
}

inline int C(i64 n, int m) {
	if(n < 0 || m < 0 || n < m) return 0;
	n %= Mod; if(!n || !m) return 1;
	int ans = 1;
	for(int i = 0; i < m; i++)
		ans = 1ll * ans * (n-i) % Mod;
	return 1ll * ans * inv[m] % Mod;
}

signed main() {
	read(n), read(m);
	for(int i = 1; i <= n; i++) read(A[i]);
	pre(); i64 ans = 0;
	for(int i = 0; i < 1 << n; i++) {
		if(siz[i] & 1) ans -= C(val[i], n-1);
		else ans += C(val[i], n-1);
		if(ans < 0) ans += Mod;
		if(ans >= Mod) ans -= Mod;
	}
	cout << ans << endl;
	return 0;
}
//2 270030023747
//891135146290 437305641972

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll P=1e9+7;
ll n,m,a[25],inv[25],ans;
void init(ll x){
	inv[0]=0;inv[1]=1;
	for(ll i=2;i<=x;i++) inv[i]=(P-P/i)*inv[P%i]%P;
}
ll C(ll x,ll y){
	if(y>x)return 0;
	ll res=1;x=x%P;
	for(ll i=x;i>=x-y+1;i--) res=res*i%P;
	for(ll i=1;i<=y;i++) res=res*inv[i]%P;
	return res;
}
int main()
{
	cin>>n>>m;
	init(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int x=0;x<(1<<n);x++){
		ll t=n+m,p=0;
		for(int i=0;i<n;i++){
			if(x>>i&1) p++,t-=a[i];
		}
		t-=p+1;
		if(p&1) ans=(ans-C(t,n-1)+P)%P;
		else ans=(ans+C(t,n-1))%P;
	}
	cout<<ans<<endl;
	return 0;
}

/********************************************
*                                           *
*    Solved By : Bir Bahadur Khatri(B'ru)   *
*      Be Positive,be Happy.                *
*                                           *
*********************************************/

#define ff first
#define D double
#define sz size()
#define ss second
#define PB push_back
#define MP make_pair
#define SQR(n) (n*n)
#define CHR getchar()
#define NL printf("\n")
#include<bits/stdc++.h>
#define ULL unsigned LL
#define PI 2.0*acos(0.0)
#define LL long long int
#define S1(a) a=in<int>()
#define SL1(a) a=in<LL>()
#define Max(a,b) ((a>b)?a:b)
#define Min(a,b) ((a<b)?a:b)
#define all(a) a.begin(),a.end()
#define _Max(a,b,c) Max(a,Max(b,c))
#define _Min(a,b,c) Min(a,Min(b,c))
#define SL2(a,b) a=in<LL>(),b=in<LL>()
#define F(i,a,b) for(int i=a;i<b; i++)
#define S2(a,b) a=in<int>(),b=in<int>()
#define R(i,a,b) for(int i=a-1;i>=b; i--)
#define BitCnt(a) __builtin_popcountll(a)
#define MEM(a,val) memset(a,val,sizeof(a))
#define SL3(a,b,c) a=in<LL>(),b=in<LL>(),c=in<LL>()
#define S3(a,b,c) a=in<int>(),b=in<int>(),c=in<int>()
#define _cin ios_base::sync_with_stdio(0); cin.tie(0)
#define cp printf("***** here here here here *****\n");
#define trace1(x)                cerr << #x << ": " << x << endl;
#define InpOut freopen("A.in","r",stdin),freopen("A1.out","w",stdout)
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;

using namespace std;
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch = getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')     break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')   break;}return (ng?-n:n);}
template<typename T>inline T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
template<typename T>inline T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template<typename T>inline T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
long long Bigmod(long long base, long long power, long long MOD){long long ret=1;while(power){if(power & 1)ret=(ret*base)%MOD;base=(base*base)%MOD;power>>=1;}return ret;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
template <typename T> LL isLeft(T a,T b,T c) {return(a.x-b.x)*(b.y-c.y)-(b.x-c.x)*(a.y-b.y);}
long long ModInverse(long long number, long long MOD){return Bigmod(number, MOD-2, MOD);}
bool isConst(char ch){if (isalpha(ch) && !isVowel(ch)) return true; return false;}
int toInt(string s)  { int sm; stringstream ss(s); ss>>sm; return sm; }
///**********************************************************//

#define MD1 1000000007ULL
#define MD2 1000000009ULL
#define MD3 1000000021ULL
#define BS1 10000019ULL
#define BS2 10000079ULL
#define BS3 10000103ULL
#define PUL pair<ULL,ULL>
#define PLL pair<LL,LL>
#define PII pair<int,int>

///         0123456789
#define MX  200007
#define MOD 1000000007
#define INF 2000000000
#define EPS 1e-9

/// ==========================================////
LL F[102];
LL Iv[102];

void Pre() {
    F[0]=1;
    Iv[0]=ModInverse(F[0],MOD);

    F(i,1,21) {
        F[i]=(F[i-1]*i)%MOD;
        Iv[i]=ModInverse(F[i],MOD);
    }
}

LL NcR(LL n,LL r) {
    if(n<r) return 0;
    r=min(r,n-r);
    LL ans=1;
    for(LL i=n;i>=(n-r)+1;i--) {
        LL tp=(i%MOD);
        ans=(ans*tp)%MOD;
    }
    ans=(ans*Iv[ r ])%MOD;
    return ans;

}

LL a[102];

int main()
{
    Pre();

    int n;
    S1(n);
    LL m;
    SL1(m);

    F(i,0,n) SL1(a[i]);
    LL ans=0;
    for(int i=0;i<(1<<n);i++) {
        LL nw=m;
        int to=0;
        for(int j=0;j<n;j++) {
            if(i&(1<<j)) {
                nw-=(a[j]+1);
                to++;
            }
        }
        if(nw<0) continue;

        LL tp=NcR(nw+n-1,n-1);
        ans+=(tp*( (to%2)==1?-1:1 ));
        ans%=MOD;
    }
    ans=(ans+MOD)%MOD;
    printf("%lld\n",ans);

    return 0;
}
///============= Thank You ===================///

#include <bits/stdc++.h>

const long long MOD = 1e9 + 7;
long long inv[21];

long long mod ( long long x ) {
    if ( x < MOD ) {
        return x;
    }
    return x % MOD;
}
long long mul ( long long a , long long b ) {
    return mod(mod(a) * mod(b));
}
long long sum ( long long a , long long b ) {
    return mod(mod(a) + mod(b));
}
long long sub ( long long a , long long b ) {
    return sum(a, MOD - mod(b));
}

int bitcount ( int x ) {
    return __builtin_popcount(x);
}

bool is_on ( int mask , int bit ) {
    return mask & (1 << bit);
}

long long modinv ( long long x ) {
    long long b, e;

    b = 1;
    e = MOD - 2;
    while ( e > 0 ) {
        if ( e & 1 ) {
            b = mul(b, x);
        }
        x = mul(x, x);
        e >>= 1;
    }

    return b;
}

long long count ( long long s , const long long& n ) {
    long long answer, i;

    if ( s < 0 || n < 0 || s < n ) {
        return 0;
    }

    s = mod(s);

    answer = 1;
    for ( i = 0 ; i < n ; ++ i ) {
        answer = mul(answer, sub(s, i));
        answer = mul(answer, inv[i + 1]);
    }

    return answer;
}

long long f ( const long long& mask , const long long& n , const long long& s , const std::vector<long long>& r ) {
    int i;
    long long target;

    target = s;
    for ( i = 0 ; i < n ; ++ i ) {
        if ( is_on(mask, i) ) {
            target -= r[i] + 1;
        }
    }

    return count(target + n - 1, n - 1);
}

long long solve ( const long long& n , const long long& s , const std::vector<long long>& r ) {
    int mask, limit;
    long long answer;

    answer = 0;
    limit = (1 << n);
    for ( mask = 0 ; mask < limit ; ++ mask ) {
        if ( bitcount(mask) & 1 ) {
            answer = sub(answer, f(mask, n, s, r));
        }
        else {
            answer = sum(answer, f(mask, n, s, r));
        }
    }

    return answer;
}

int main ( void ) {

    int i;
    long long n, s, x;
    std::vector<long long> r;

    std::cin >> n >> s;
    for ( i = 0 ; i < n ; ++ i ) {
        std::cin >> x;
        r.push_back(x);
        inv[i+1] = modinv(i + 1);
    }

    std::cout << solve(n, s, r) << std::endl;

    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define N 4200000
#define INF 2147483647
#define MOD 1000000007
#define int64 long long
#define S(a) scanf("%d",&a)
#define Sl(a) scanf("%I64d",&a)
#define cl(a,b) memset(a,b,sizeof(a))
#define foru(i,a,b) for(int i=a;i<=b;++i)
#define ford(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(int i=g[a];i;i=next[i])

using namespace std;
int64 ans,ny,y[N],x[N],a[N],s;
int tot,n;
void work(int64 a)
{
    int b=tot;
    foru(i,1,b) y[++tot]=y[i]+a,x[tot]=MOD-x[i];
}
int64 com(int64 a,int b)
{
    int64 res=1; a%=MOD;
    foru(i,1,b) res=res*(a-i+1)%MOD;
    res=res*ny%MOD;
    return res;
}
int64 qpow(int a,int b)
{
    if(!b) return 1;
    int64 res=qpow(a,b>>1); res=res*res%MOD;
    if(b&1) res=res*a%MOD;
    return res;
}
int main()
{
    S(n),Sl(s);
    foru(i,1,n) Sl(a[i]);
    tot=1; x[1]=1; y[1]=0; ans=0; ny=1;
    foru(i,1,n) work(++a[i]);
    foru(i,1,n-1) ny=ny*i%MOD; ny=qpow(ny,MOD-2);
    foru(i,1,tot)
      if(s-y[i]+n-1>=(int64)n-1) ans=(ans+com(s-y[i]+n-1,n-1)*x[i]%MOD+MOD)%MOD;
    ans=(ans+MOD)%MOD;
    printf("%I64d\n",ans);
    return 0;
}

/*
██████████████████████████████████████████████████████████████████████████████
██              ██████    ██████      ██      ██  ██    ██████              ██
██  ██████████  ██  ██      ██      ██████████████  ██████  ██  ██████████  ██
██  ██      ██  ██    ██  ████      ██    ██████████    ██  ██  ██      ██  ██
██  ██      ██  ██    ██  ██      ██  ████        ██  ████  ██  ██      ██  ██
██  ██      ██  ██  ██████  ████  ████████████  ██    ████████  ██      ██  ██
██  ██████████  ██  ████  ██    ████    ████  ██████  ████  ██  ██████████  ██
██              ██  ██  ██  ██  ██  ██  ██  ██  ██  ██  ██  ██              ██
████████████████████  ██  ██    ██████  ██    ████  ████    ██████████████████
██████  ████          ████        ██    ██    ████  ████████  ██          ████
████  ██      ██  ██      ██  ██████  ████  ████    ██    ████    ████████  ██
██      ██      ██    ██    ████      ████        ██████  ██      ██  ██    ██
██  ██    ████████████  ████  ██  ████            ████  ████████████  ████  ██
██  ██      ██  ██  ████    ████████                ████████      ██  ██    ██
██  ██  ██  ██████████  ████    ██  ████  ██    ████  ████        ████  ██  ██
██    ██  ████  ██████  ██    ******************    ████  ██            ██  ██
██    ██████  ██  ██████      * Scan this QR   *██████    ██  ██  ██  ████████
████  ████  ██  ██████      ██* code to join   *██  ████    ██  ████████  ████
██████      ████████  ██      * in the Three   *██  ████          ████  ██  ██
████              ████  ████  * Body ETO.      *  ████        ██  ████  ██  ██
██████  ██    ████████        *  --ETO manager *██  ██                ██    ██
████    ██  ██  ██    ██████  *    Ye Wenjie   *████  ████  ██  ████  ██  ████
██  ████  ██████    ████  ██  *ETO(C),1988~2018*      ██  ██  ██  ██    ██████
██  ██████  ██  ████    ██  ██******************          ██████    ██████  ██
██  ██  ██    ████    ██        ██  ██        ████████      ████  ██  ██    ██
████████████    ██    ██████  ██████████  ██  ████  ██████████    ██  ██  ████
██████████    ██  ████  ██        ██    ██████████  ██    ██      ██  ██    ██
██    ██  ████    ██  ████  ████      ██████    ██    ██      ██  ██  ████  ██
██████  ██  ██████  ██            ██████████  ██    ██    ████  ████  ██    ██
██      ██████  ████  ████  ████      ████    ████  ████            ██████████
██████████████████      ██  ██  ████  ██    ██  ██    ████  ██████    ██    ██
██              ██        ████████████  ████  ██  ██  ██    ██  ██      ██  ██
██  ██████████  ██    ████  ██████  ██  ██████████████      ██████    ██  ████
██  ██      ██  ████████    ██  ██      ████  ████  ██              ████  ████
██  ██      ██  ████  ████  ████  ██████  ██████████████  ██████████    ██  ██
██  ██      ██  ██    ██████  ██  ██  ██████████  ██  ██      ████    ██    ██
██  ██████████  ██████  ████            ██    ████████  ██  ████    ██████████
██              ██████    ████  ████████  ██  ████    ██    ██  ████  ████  ██
██████████████████████████████████████████████████████████████████████████████
    扫    描    二    维    码    加    入    三    体    E    T    O
*/
/*****************
 *   I<3   C++   *
 *  IWANT ANYAC  *
 * ILOVEPROGRAM! *
 *IT'SINTERESTING*
 * ILOVEPROGRAM! *
 *  INCONTESTS   *
 *   GETSCORE    *
 *    ACCODE     *
 *     LETS      *
 *      GO       *
 *Written by:    *
 *    charlieyan *
 *****************/
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <locale>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <limits>
#include <map>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <istream>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <cwchar>
#include <cwctype>
#include <numeric>
#include <list>
#define LL long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define FILL(a,v) memset((void*)a,v,sizeof(a))
#define FILL0(a) FILL(a,0)
#define FILL1(a) FILL(a,-1)
#define FILLBIG(a) FILL(a,0x3f)
#define ALL(a) (a).begin(),(a).end()
#define Inf ((int)0x3f3f3f3f)
#define INF ((long long)0x3f3f3f3f3f3f3f3f)
#define Mod 1000000007
#define foreach(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define FOR(i,x) for(int i=0;i<x;i++)
#define RFOR(i,x) for(int i=x-1;i>=0;i--)
#define FFOR(i,a,b) for(int i=a;i<b;i++)
#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second
#define OVER(...) return printf(__VA_ARGS__),0
#define fastio ios::sync_with_stdio(0)
#define filei(f) freopen(f,"r",stdin)
#define fileo(f) freopen(f,"w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define MASK(a) (1<<(a))
#define MASKX(x,a) ((x)<<(a))
#define BIT(a,b) (((a)>>(b))&1)
#define cddx(a) priority_queue<a >
#define cxdd(a) priority_queue<a,vector<a >,greater<a > >
#define deval(a) {cerr<<#a<<" = "<<a<<endl;}
#define dearr(be,en) {cerr<<#be;cerr<<" = {";for(auto i=be;i!=en;i++)cerr<<' '<<*i;cerr<<" }\n";}
#define reg register
#define prtime eprintf("\n\nTime used: %dms\n",clock());
#define PI 3.1415926535897932384626
#define TODEG(a) (a*180/PI)
#define y0 ykangjimutigeidiqiuyipianjingtu
#define y1 yxiaomiexuduhuanrenleiwannianankang
#define endl '\n'
//抗击母体，给地球一片净土
//消灭徐毒，还人类万年安康
using namespace std;
typedef pair<int,int> pii;
typedef unsigned long long UINT;
typedef unsigned int uint;
typedef long long INT;
typedef long double ldouble;
typedef pair<INT,INT> PII;
typedef stringstream sst;
typedef istringstream iss;
typedef vector<int> vint;
typedef vector<INT> VINT;
typedef vector<pii> vpii;
typedef vector<PII> VPII;
typedef priority_queue<int> pqi;
typedef priority_queue<INT> PQI;
typedef priority_queue<pii> pqp;
typedef priority_queue<PII> PQP;
typedef priority_queue<int,vint,greater<int> > xqi;
typedef priority_queue<INT,VINT,greater<INT> > XQI;
typedef priority_queue<pii,vpii,greater<pii> > xqp;
typedef priority_queue<PII,VPII,greater<PII> > XQP;
struct fastIO
{
	inline fastIO operator>>(int& num)
	{
		num=0;
		char c=getchar();
		while(c!='-'&&(c<'0'||c>'9'))c=getchar();
		bool foo=0;
		if(c=='-')
		{
			foo=1;
			c=getchar();
		}
		while(c>='0'&&c<='9')
		{
			num=(num<<3)+(num<<1)+c-'0';
			c=getchar();
		}
		if(foo)num=-num;
		return *this;
	}
	inline fastIO operator>>(INT& num)
	{
		num=0;
		char c=getchar();
		while(c!='-'&&(c<'0'||c>'9'))c=getchar();
		bool foo=0;
		if(c=='-')
		{
			foo=1;
			c=getchar();
		}
		while(c>='0'&&c<='9')
		{
			num=(num<<3)+(num<<1)+c-'0';
			c=getchar();
		}
		if(foo)num=-num;
		return *this;
	}
	inline fastIO operator>>(float& num)
	{
		scanf("%f",&num);
		return *this;
	}
	inline fastIO operator>>(double& num)
	{
		scanf("%lf",&num);
		return *this;
	}
	inline fastIO operator>>(long double& num)
	{
		scanf("%Lf",&num);
		return *this;
	}
	inline fastIO operator>>(char& num)
	{
		num=getchar();
		while(num==' '||num=='\n')num=getchar();
		return *this;
	}
	inline fastIO operator>>(char* num)
	{
		int cnt=0;
		char c=getchar();
		while(c==' '||c=='\n')c=getchar();
		while(c!=' '&&c!='\n')
		{
			num[cnt++]=c;
			c=getchar();
		}
		num[cnt]=0;
		return *this;
	}
	inline fastIO operator>>(string& num)
	{
		cin>>num;
		return *this;
	}
	inline void printInt(const int& num)
	{
		if(num<10)
		{
			putchar(num+'0');
			return;
		}
		printInt(num/10);
		putchar((num%10)+'0');
	}
	inline void printINT(const INT& num)
	{
		if(num<10)
		{
			putchar(num+'0');
			return;
		}
		printINT(num/10);
		putchar((num%10)+'0');
	}
	inline fastIO operator<<(const int& num)
	{
		if(num<0)putchar('-'),printInt(-num);
		else printInt(num);
		return *this;
	}
	inline fastIO operator<<(const INT& num)
	{
		if(num<0)putchar('-'),printINT(-num);
		else printINT(num);
		return *this;
	}
	inline fastIO operator<<(const float& num)
	{
		printf("%.10f",num);
		return *this;
	}
	inline fastIO operator<<(const double& num)
	{
		printf("%.16lf",num);
		return *this;
	}
	inline fastIO operator<<(const long double& num)
	{
		printf("%.20Lf",num);
		return *this;
	}
	inline fastIO operator<<(const char& num)
	{
		putchar(num);
		return *this;
	}
	inline fastIO operator<<(const char* num)
	{
		for(int i=0;num[i];i++)
			putchar(num[i]);
		return *this;
	}
	inline fastIO operator<<(const string& num)
	{
		cout<<num;
		return *this;
	}
}fio;
//Coded by Charlieyan
//版权所有，翻印必究

INT n,s;
INT f[22];
INT fan[22];

INT ksmii(INT a,INT b){
	if(!b){
		return 1;
	}
	INT fa=ksmii(a,b/2);
	fa=fa*fa%Mod;
	if(b%2){
		fa=fa*a%Mod;
	}
	return fa;
}

INT C(INT x,INT y){
	if(!x&&!y){
		return 1;
	}
	if(x<=0){
		return 0;
	}
	INT ans=1;
	for(INT i=1,j=x;i<=y;i++,j--){
		ans=ans*(j%Mod)%Mod*fan[i]%Mod;
	}
	//cerr<<x<<' '<<y<<' '<<ans<<endl;
	return ans;
}

int main(){
	fio>>n>>s;
	for(int i=0;i<n;i++){
		fio>>f[i];
	}
	for(int i=1;i<=n;i++){
		fan[i]=ksmii(i,Mod-2);
	}
	INT ans=0;
	for(int i=0;i<MASK(n);i++){
		INT sum=s+n-1;
		int cnt=0;
		for(int j=0;j<n;j++){
			if(BIT(i,j)){
				sum-=f[j]+1;
				cnt++;
			}
		}
		if(cnt%2){
			ans=(ans+Mod-C(sum,n-1))%Mod;
		}else{
			ans=(ans+C(sum,n-1))%Mod;
		}
		//cerr<<i<<' '<<ans<<endl;
	}
	fio<<ans<<endl;
	return 0;
}

#include <iostream>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <string.h>
#include <math.h>
#include <sstream>
#include <stdio.h>

using namespace std;
typedef long long ll;
const int maxn = 2 * 100000 + 10, MOD = 1000 * 1000 * 1000 + 7, INF = 1000 * 1000 * 1000;
const ll LINF = (1ll) << 60;
#define sz(x) ((int) (x).size())
#define pB push_back
#define mP make_pair
#define X first
#define Y second
#define pii pair<int, int>
#define endl "\n"
#define show(x) {cout << (#x) << " = " << x << endl;}
const double EPS = 1e-9, PI = 2. * acos(0.0);

vector <ll> f;

int mul(int a, int b) {
	return (int) (((ll) a * b) % MOD);
}

int add(int a, int b) {
	return ((a + b) % MOD);
}

int exGCD(int a, int b, int &x, int &y) {
	if (b == 0) {
		x = 1; y = 0;
		return a;
	}

	int xx, yy;
	int d = exGCD(b, a % b, xx, yy);
	x = yy;
	y = xx - a / b * yy;
	return d;
}

int modInverse(int a, int mod) {
	int x, y;
	int gcd = exGCD(a, mod, x, y);
	if (gcd != 1) {
		return -1;
	}
	x = x % mod;
	if (x < 0) {
		x += mod;
	}
	return x;
}

int C(ll n, int r) {
	if (n < 0 || r > n) {
		return 0;
	}
	if (r == 0) {
		return 1;
	}
	if (n == 0 ) {
		return 0;
	}
	int ret = 1;

	for (ll i = n; i >= n - r + 1; i--) {
		ret = mul(ret, (int) (i % MOD));
	}
	for (int i = 1; i <= r; i++) {
		ret = mul(ret, modInverse(i, MOD));
	}

	return ret;
}

int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// ios_base::sync_with_stdio(false);

	int n; cin >> n;
	ll sum; cin >> sum;
	f.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> f[i];
	}

	int ans = 0;
	for (int mask = 0; mask < (1 << n); mask++) {
		ll curSum = sum + n - 1;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if ((mask & (1 << i)) != 0) {
				cnt++;
				curSum -= f[i] + 1;
			}
		}

		// cout << "here!!" << endl;
		// cout << curSum << ' ' << n - 1 << " = ";
		int curVal = C(curSum, n - 1);
		// cout << curVal << endl;
		// cout << "herww!!" << endl;
		if (cnt % 2 == 0) {
			ans = (ans + curVal) % MOD;
		}
		else {
			ans = (ans - curVal + MOD) % MOD;
		}

	}

	cout << ans << endl;

	return 0;
}

/**
*	 built in Contest Parser [Version 1.01]
**/

#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
long long a[22],m,ans=0;
int inv[22],n;

// a^b
int q_pow(int a,int b){
	int c=1;
	for(;b;b>>=1){
		if(b&1)
			c=(long long)c*a%mod;
		a=(long long)a*a%mod;
	}
	return c;
}

// C(y,x)
int C(long long y,int x){
	if(y<0||x<0||y<x)
		return 0;
	y%=mod;
	if(y==0||x==0)
		return 1;
	int ans=1;
	for(int i=0;i<x;++i)
		ans=(long long)ans*(y-i)%mod;
	for(int i=1;i<=x;++i)
		ans=(long long)ans*inv[i]%mod;
	return ans;
}

int main(){
	for(int i=1;i<=20;++i)
		inv[i]=q_pow(i,mod-2);
	cin>>n>>m;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	for(int x=0;x<1<<n;++x){
		if(x==0){
			ans=(ans+C(n+m-1,n-1))%mod;
		}
		else{
			long long t=n+m;
			int p=0;
			for(int i=0;i<n;++i)
				if(x>>i&1){
					p++;
					t-=a[i+1];
				}
			t-=p+1;
			if(p&1)
				ans=(ans-C(t,n-1))%mod;
			else
				ans=(ans+C(t,n-1))%mod;
		}
	}
	cout<<(ans+mod)%mod;
}

#include <stdio.h>
#define P 1000000007
//FILE *in=fopen("input.txt","r"),*out=fopen("output.txt","w");
FILE *in=stdin,*out=stdout;
int n;
__int64 S,f[25],hap,ans,temp,mem;
int path[25],cnt;
__int64 inv(__int64 n){
	__int64 x[3]={0,1},y[3]={1},a=n,b=P,i;
	__int64 quotient=a/b;
	__int64 remainder=a%b;
	y[1]=-quotient;
	for (i=2;(b%(a%b));i++){
		a=b;
		b=remainder;
		quotient=a/b;
		remainder=a%b;
		x[i%3]=((-quotient*x[(i-1)%3])+x[(i-2)%3])%P;
		y[i%3]=((-quotient*y[(i-1)%3])+y[(i-2)%3])%P;
	}
	return x[(i-1)%3];
}
void input(){
	fscanf(in,"%d %I64d",&n,&S);
	for (int i=1;i<=n;i++){
		fscanf(in,"%I64d",&f[i]);
		hap+=f[i];
	}
	mem=1;
	for (int i=1;i<=n-1;i++){
		mem=(mem*inv(i))%P;
	}
}
inline __int64 Perm(__int64 x,__int64 y){
	__int64 calc=mem;
	if (x<0) return 0;
	__int64 up=x+y-1;
	for (__int64 i=1;i<=y-1;i++){
		calc=(calc*(up%P))%P;
		up--;
	}
	if (calc<0) calc+=P;
	return calc;
}
void pro(){
	if (hap<S){
		fprintf(out,"0");
		return;
	}
	for (int i=0;i<=(1<<n)-1;i++){
		int k=i,count=0;
		temp=0;
		for (int j=n;j>=1;j--){
			if (k>=(1<<(j-1))){
				count++;
				k-=1<<(j-1);
				temp+=f[j]+1;
			}
		}
		if (count%2==0) ans+=Perm(S-temp,n),ans%=P;
		else ans-=Perm(S-temp,n),ans%=P;
	}
	if (ans<0) ans+=P;
	fprintf(out,"%I64d",ans);
}
int main(){
	input();
	pro();
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int N = 25, MOD = 1e9+7;

int n, inv[N];
long long f[N];

int mod(long long x){
    return ((x%MOD)+MOD)%MOD;
}

int power(int a, int x){
    if(x==0) return 1;
    if(x%2==1) return ((long long)a*power(a,x-1))%MOD;
    int half = power(a,x/2);
    return ((long long)half*half)%MOD;
}

int xCp(long long x, int p){
    x %= MOD;
    int resp = 1;
    for(int i = 0; i < p; i++){
        resp = ((long long)resp*(x-i))%MOD;
        resp = ((long long)resp*inv[i+1])%MOD;
    }
    return resp;
}

int solve(int i, long long s){
    if(s<0) return 0;
    if(i==0) return xCp(s+n-1,n-1);
    return mod(solve(i-1,s)-solve(i-1,s-f[i]-1));
}

int main(){
    long long s;

    scanf("%d %lld", &n, &s);
    for(int i = 1; i <= n; i++){
        scanf("%lld", &f[i]);
    }
    for(int i = 1; i <= n; i++){
        inv[i] = power(i,MOD-2);
    }
    printf("%d\n", solve(n,s));

    return 0;
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long lt;

lt read()
{
    lt f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

const lt mod=1e9+7;
const int maxn=50;
lt a[maxn],inv[maxn];
lt ans;

lt C(lt n,lt m)
{
    if(n<0||m<0||n<m)return 0;
    if(n%mod==0||m==0)return 1;
    lt res=1;
    for(lt i=n-m+1;i<=n;++i)
    res*=(i%mod),res%=mod;
    for(int i=1;i<=m;++i)
    res*=inv[i],res%=mod;
    return res;
}

lt qpow(lt b,lt k)
{
    lt res=1;
    while(k>0)
    {
        if(k&1)res=(res*b)%mod;
        b=(b*b)%mod;
        k>>=1;
    }
    return res;
}

int main()
{
    lt n=read(),m=read();
    for(int i=1;i<=n;++i)a[i]=read();
    for(int i=1;i<=20;++i)inv[i]=qpow(i,mod-2);

    ans=C(n+m-1,n-1)%mod;
    for(int i=1;i<=(1<<n)-1;++i)
    {
        lt k=n+m,p=0;
        for(int j=0;j<n;++j)
        if((1<<j)&i)p++,k-=a[j+1];
        k-=p+1;
        if(p&1) ans-=C(k,n-1),ans%=mod;
        else ans+=C(k,n-1),ans%=mod;
    }
    printf("%lld",(ans+mod)%mod);
    return 0;
}

#include<cstdio>
#define mod 1000000007
typedef long long ll;
int n;
ll s,f[25],ans;
ll fast_power(ll x,int y)
{
	ll ret=1;
	while(y)
	{
		if(y&1) ret=ret*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return ret;
}
ll work(int x,int y)
{
	if(x<y) return 0;
	if(y>x-y) y=x-y;
	ll top=1,bottom=1;
	for(int i=y;i>=1;i--) top=top*(x-y+i)%mod,bottom=bottom*i%mod;
	return top*fast_power(bottom,mod-2)%mod;
}
ll Lucas(ll x,ll y)
{
	if(!y) return 1;
	return Lucas(x/mod,y/mod)*work(x%mod,y%mod)%mod;
}
void dfs(int now,int cnt,ll sum)
{
	if(now>n)
	{
		if(s<sum) return ;
		if(cnt&1) ans=(ans-Lucas(n+s-sum-1,n-1)+mod)%mod;
		else ans=(ans+Lucas(n+s-sum-1,n-1))%mod;
		return ;
	}
	dfs(now+1,cnt,sum);
	dfs(now+1,cnt+1,sum+f[now]+1);
}
int main()
{
	scanf("%d%lld",&n,&s);
	for(int i=1;i<=n;i++) scanf("%I64d",&f[i]);
	dfs(1,0,0);
	printf("%I64d\n",ans);
	return 0;
}

#include <bits/stdc++.h>

typedef long long LL;

const int MOD = 1e9 + 7;

int n;
LL S;
int fac[233], ifac[233];
LL a[233];
inline int Qpow(int a, int b) { int ans = 1; for (; b; a = 1LL * a * a % MOD, b >>= 1) if (b & 1) ans = 1LL * ans * a % MOD; return ans; }
inline int inv(int a) { return Qpow(a, MOD - 2); }

int C(int n, int m) {
	int ans = 1;
	for (int i = 0; i < m; ++i) ans = 1LL * ans * (n - i + MOD) % MOD;
	return 1LL * ans * ifac[m] % MOD;
}

inline void init() {
	fac[0] = 1;
	for (int i = 1; i <= 100; ++i) fac[i] = 1LL * fac[i - 1] * i % MOD;
	ifac[100] = inv(fac[100]);
	for (int i = 99; ~i; --i) ifac[i] = 1LL * ifac[i + 1] * (i + 1) % MOD;
	return;
}

int main() {
	init(), scanf("%d%lld", &n, &S);
	for (int i = 1; i <= n; ++i) scanf("%lld", a + i);
	int ans = 0;
	for (int i = 0; i < 1 << n; ++i) {
		int QAQ = 1; LL cnt = S;
		for (int j = 1; j <= n; ++j) if (i & (1 << (j - 1))) QAQ = MOD - QAQ, cnt -= a[j] + 1;
		if (cnt < 0) continue;
		ans = (ans + 1LL * QAQ * C((cnt + n - 1) % MOD, n - 1)) % MOD;
	}
	printf("%d\n", ans);
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
#define mod 1000000007
typedef long long ll;
ll s,a[22],b[22]={1};
int n,ans;
ll bin(ll a, int n)
{
    ll ans=1;
    while(n)
    {
        if(n&1)
            ans*=a,ans%=mod;
        a*=a,a%=mod;
        n/=2;
    }
    return ans;
}
void f(int pos, ll s, int cnt)
{
    if(pos>n)
    {
        ll calc=1;
        if(s<n)
            return;
        for(ll i=s-n+1;i<=s-1;i++)
            calc*=(i%mod),calc%=mod;
        calc*=b[n-1],calc%=mod;
        if(cnt&1)
            ans=ans-calc+mod;
        else
            ans=ans+calc;
        if(ans>=mod)
            ans-=mod;
        return;
    }
    f(pos+1,s,cnt);
    f(pos+1,s-a[pos],cnt+1);
}
int main()
{
    scanf("%d%I64d",&n,&s);
    ll fa=1;
    for(int i=1;i<=n;i++)
        fa*=i,fa%=mod,b[i]=bin(fa,mod-2);
    s+=n;
    for(ll i=1;i<=n;i++)
        scanf("%I64d",&a[i]),a[i]++;
    f(1,s,0);
    printf("%d",ans);
}

#pragma GCC diagnostic error "-std=c++11"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll mod = 1e9+7;
const int maxn = 5e5 + 1000;

/* ******************************** */
/*  arithmetic operators in modular */
inline void add(int &a, int b)
{
    a += b;
    if (a >= mod)
        a -= mod;
}

inline void sub(ll &a, ll b)
{
    a -= b;
    if (a < 0)
        a += mod;
}

inline ll mul1(ll a, ll b)
{
    return (ll)((ull)a * b % mod);
}
inline ll mul2(ll a, ll b, ll x)
{
    ll ans = 0;
    while (b)
    {
        if (b & 1)
            ans = (ans + a) % x;
        b >>= 1, a = (a << 1) % x;
    }
    return ans;
}

inline ll mpow(ll a, ll p)
{
    ll res = 1;
    while (p)
    {
        if (p & 1)
            res = mul1(res, a);
        p >>= 1;
        a = mul1(a, a);
    }
    return res;
}

inline ll mpow(ll a, ll b, ll p)
{
    ll ans = 1 % p;
    while(b)
    {
        if(b&1) ans=ans*a%p;
        a=a*a%p;
        b>>=1;
    }
    return ans;
}

inline int inv(int a)
{
    a %= mod;
    if (a < 0)
        a += mod;
    int b = mod, u = 0, v = 1;
    while (a)
    {
        int t = b / a;
        b -= t * a;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    assert(b == 1);
    if (u < 0)
        u += mod;
    return u;
}
int inver[1000];
/* ********************************/

/* ********************************/
/*  something about prime  */
bool is_prime_by_try(int n)
//small range and time complexity isO(sqrt(N))
{
    if (n < 2)
        return false;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

inline bool test(int n, int a, int d)
{
    if (n == 2)
        return true;
    if (n == a)
        return true;
    if ((n & 1) == 0)
        return false;
    while (!(d & 1))
        d >>= 1;
    int t = mpow(a, d, n);
    while (d != n - 1 && t != n - 1 && t != 1)
    {
        t = (ll)t * t % n;
        d = d << 1;
    }
    return (t == n - 1 || (d & 1) == 1);
}

bool is_prime_by_random(ull n)
{
    if (n < 2)
        return false;
    int a[] = {2, 3, 61};
    for (int i = 0; i < 3; i++)
        if (!test(n, a[i], n - 1))
            return false;
    return true;
}
const int prime_maxn = 5e6 + 1000;
int isprime[prime_maxn];
void get_prime(int n)
//Eratosthenes method,O(N log (log N))
{
    fill(isprime, isprime + prime_maxn, 1);
    isprime[0] = 0, isprime[1] = 0;
    for (int i = 2; i <= n; i++)
    {
        if (!isprime[i])
            continue;
        //cout<<i<<endl;
        for (int j = i; j <= n / i; j++)
            isprime[i * j] = false;
    }
}

int primenum = 0, prime[prime_maxn], is_not_prime[prime_maxn];
void primes(int n)
{
    // linear method(O(N))
    memset(prime, 0, sizeof(prime_maxn));
    memset(is_not_prime, 0, sizeof(is_not_prime));
    primenum = 0;
    for (int i = 2; i <= n; i++)
    {
        if (!is_not_prime[i])
        {
            is_not_prime[i] = i, prime[++primenum] = i;
        }
        for (int j = 1; j <= primenum; j++)
        {
            if (prime[j] > is_not_prime[i] || prime[j] > n / i)
                break;
            is_not_prime[i * prime[j]] = prime[j];
        }
    }
    //for(int i=1;i<=primenum;i++) cout<<prime[i]<<endl;
}
/* ******************************* */

/* ******************************* */
// factorize

vector<pair<ll, int>> fac;
void divide(int n)
{
    fac.clear();
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            int div = 0;
            while (n % i == 0)
            {
                n /= i;
                div++;
            }
            fac.push_back(make_pair(i, div));
        }
    }
    if (n > 1)
        fac.push_back(make_pair(n, 1));
    // for(auto it:fac)
    // {
    //     cout<<it.first<<"^"<<it.second<<endl;
    // }
}

/* ******************************* */

/* ******************************* */
// get phi
ll phi(ll n)
{
    ll ans = n;
    for (ll i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ans = ans / i * (i - 1);
            while (n % i == 0)
                n /= i;
        }
    }
    if (n > 1)
        ans = ans / n * (n - 1);
    return ans;
}
// modified to get faster phi
ll phi_table1[maxn];
void Eratosthenes_way_to_get_phi(ll n)
{
    for (int i = 2; i <= n; i++)
        phi_table1[i] = i;
    for (int i = 2; i <= n; i++)
    {
        if (phi_table1[i] == i)
        {
            for (int j = i; j <= n; j += i)
            {
                phi_table1[j] = phi_table1[j] / i * (i - 1);
            }
        }
    }
}

/* ******************************* */
/*求解不定方程*/
inline ll gcd(ll a, ll b)
{
    return !b ? a : gcd(b, a % b);
}
inline ll exgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    int r = exgcd(b, a % b, y, x);
    y -= x * (a / b);
    return r;
}
/* ******************************* */

/* ******************************* */
/*求解同余不定方程组*/
//Chinese Remaining Theory
// ll a[maxn], m[maxn];
//equations like x%(m[i])==a[i]
// ll CRT(ll a[], ll m[], ll n)
// {
//     if (n == 1)
//     {
//         if (m[0] > a[0])
//             return a[0];
//         else
//             return -1;
//     }
//     LL x, y, d;
//     for (int i = 1; i < n; i++)
//     {
//         if (m[i] <= a[i])
//             return -1;
//         d = ex_gcd(m[0], m[i], x, y);
//         if ((a[i] - a[0]) % d != 0)
//             return -1; //不能整除则无解
//         LL t = m[i] / d;
//         x = ((a[i] - a[0]) / d * x % t + t) % t; //第0个与第i个模线性方程的特解
//         a[0] = x * m[0] + a[0];
//         m[0] = m[0] * m[i] / d;
//         a[0] = (a[0] % m[0] + m[0]) % m[0];
//     }
//     return a[0];
// }
/* ******************************* */

/* ******************************* */
//BSGS&&exBSGS&&primitive root
// solve equations like (a^x)%p==b

ll bsgs(ll a, ll b, ll p)
{
    map<ll,ll>tab;
    ll u=(ll) sqrt(p)+1;
    ll now=1,step;
    for(ll i=0;i<u;i++)
    {
        ll tmp=b*mpow(now,p-2,p)%p;
        if(!tab.count(tmp)) tab[tmp]=i;
        now=now*a%p;
    }
    step=now;
    now=1;
    for(ll i=0;i<p;i+=u)
    {
        if(tab.count(now)) return i+tab[now];
        now=now*step%p;
    }
    return -1;
}
/* ******************************* */

/* ******************************* */
// solve C(a,b)
namespace combination{
    int inv[maxn];
    ll C(ll n,ll m)
    {
        if(n<m) return 0;
        ll ans=1;
        for(int i=0;i<m;i++)
        ans=ans*(n-i)%mod*inv[i+1]%mod;
        return ans;
    }
    ll Lucas(ll n,ll m)
    {
        if(n<0) return 0;
        if(!m) return 1;
        return Lucas(n/mod,m/mod)*C(n%mod,m%mod)%mod;
    }
}
/* ******************************* */
ll n,s,f[100];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>s;
    for(int i=1;i<=n;i++)
    cin>>f[i];
    for(int i=1;i<=20;i++)
    combination::inv[i]=mpow(i,mod-2);
    ll ans=0;
    for(int x=0;x<(1<<n);x++)
    {
        // cout<<combination::Lucas(n+s-1,n-1)<<" "<<combination::Lucas(t,n-1)<<endl;
        if(x==0) ans=(ans+combination::Lucas(n+s-1,n-1))%mod;
        else
        {
            ll t=n+s;
            ll p=0;
            for(int i=0;i<n;i++)
            {
                if((x>>i)&1) p++,t-=f[i+1];
            }
            t-=p+1;
            // cout<<n<<" "<<s<<" "<<t<<" "<<p<<" ";
            // cout<<combination::Lucas(n+s-1,n-1)<<" "<<combination::Lucas(t,n-1)<<endl;
            if(p&1) ans=(ans-combination::Lucas(t,n-1))%mod;
            else    ans=(ans+combination::Lucas(t,n-1))%mod;
        }
    }
    cout<<(ans+mod)%mod<<endl;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long
const int p=1e9+7;
const int N=50;
int a[N],inv[N],n,m,ans;
int read(){
	int sum=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return sum*f;
}
int ksm(int x,int b){
	int tmp=1;
	while(b){
		if(b&1)tmp=tmp*x%p;
		b>>=1;
		x=x*x%p;
	}
	return tmp;
}
int C(int x,int y){
	if(x<0||y<0||x<y)return 0;
	x%=p;
	if(x==0||y==0)return 1;
	int ans=1;
	for(int i=0;i<y;i++)ans=ans*(x-i)%p;
	for(int i=1;i<=y;i++)ans=ans*inv[i]%p;
	return ans;
}
signed main(){
	for(int i=1;i<=20;i++)inv[i]=ksm(i,p-2);
	n=read();m=read();
	for(int i=1;i<=n;i++)a[i]=read();
	for(int i=0;i<(1<<n);i++){
		if(i==0){
			ans=(ans+C(n+m-1,n-1))%p;
			continue;
		}
		int x=n+m;
		int num=0;
		for(int j=0;j<n;j++)
			if(i>>j&1)num++,x-=a[j+1];
		x-=num+1;
		if(num&1)ans=(ans-C(x,n-1)+p)%p;
		else ans=(ans+C(x,n-1))%p;
	}
	printf("%lld",ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long n;
long long flower[25],S,inv[25],ou,ji,all;
long long lowbit(long long x) {return x&(-x);}
long long quick(long long x,long long y)
{
	long long r=1;
	while(y)
	{
		if(y&1) r=r*x%mod;
		y>>=1;x=x*x%mod;
	}
	return r%mod;
}
long long combine(long long x,long long m)
{
	if(m<x) return 0;
	long long r=1;
	for(long long i=x-1;i>=0;i--) r=(r%mod*((m-i)%mod))%mod*inv[x-i]%mod;
	return r%mod;
}
int main()
{
	for(long long i=1;i<=20;i++)
		inv[i]=quick(i,mod-2);
	scanf("%d%lld",&n,&S);
	for(long long i=1;i<=n;i++) scanf("%lld",&flower[i]);
	all=combine(n-1,S-1+n);
	for(long long i=1;i<=(1<<n)-1;i++)
	{
		long long l=0;
		long long u=0;
		for(long long j=i;j;j-=lowbit(j)) {
			l++,u+=flower[(long long)(log2(lowbit(j))+1)];}
		if(l&1) ji=(ji%mod+combine(n-1,S-u-l+n-1)%mod)%mod;
		else	ou=(ou%mod+combine(n-1,S-u-l+n-1)%mod)%mod;
	//	if(i<=10)
	//	cout<<ji<<" "<<ou<<" "<<all<<" "<<i<<" "<<S-u-l+n-1<<" "<<combine(n-1,S-u-l+n-1)<<endl;
	}
	cout<<((all+ou+mod)-ji)%mod<<endl;
	return 0;
}

#include <iostream>
using namespace std;

typedef long long LL;
const int kN = 25, kMod = 1000000007;
LL n, m, a[kN], g[kN] = {1}, ans;  // g: 阶乘

LL Power(LL x, LL y) {  // (x^y) mod kMod
  LL ans = 1;
  for (x %= kMod; y; y >>= 1) {
    if (y & 1) ans = ans * x % kMod;
    x = x * x % kMod;
  }
  return ans % kMod;
}

LL C(LL x, const LL &y) {
  // x! / (y! * (x-y)!) = ∏<x-y+1, y> / y!
  if (x < 0 || y < 0 || x < y) return 0;
  if ((x %= kMod) == 0 || y == 0) return 1;
  LL ans = 1;

  for (int i = 0; i < y; i++)
    ans = ans * (x - i) % kMod;
  return ans * Power(g[y], kMod - 2) % kMod;
}

int main () {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    cin >> a[i], g[i] = g[i - 1] * i % kMod;

  ans = C(n + m - 1, n - 1) % kMod;

  for (int i = 1, sz = 1 << n; i < sz; i++) {
    LL t = n + m, cnt = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) cnt++, t -= a[j + 1];
    t -= cnt + 1;

    if (cnt & 1)
      ans = (ans - C(t, n - 1)) % kMod;
    else
      ans = (ans + C(t, n - 1)) % kMod;
  }

  cout << (ans % kMod + kMod) % kMod;
  cout << flush;
  return 0;
}

#include <bits/stdc++.h>
#define For(i, a, b) for(register int i = (a); i <= (b); ++i)
#define Rof(i, a, b) for(register int i = (a); i >= (b); --i)
#define INF 0x3f3f3f3f
#define LL long long
#define Mod 1000000007
using namespace std;
int N;
LL A[21], M, Ans, Inv[21], Pos = 1;
LL Pow(LL a, int k) {
	LL Ret = 1;
	for(;k ; k >>= 1, a = a * a % Mod) if(k & 1) Ret = Ret * a % Mod;
	return Ret;
}
LL C(LL x, int y) {
	if(x < 0 || y < 0 || x < y) return 0;
	if(x == y || y == 0) return 1;
	x %= Mod;
	LL Ret = 1;
	For(i, 0, y - 1) Ret = Ret * (x - i) % Mod;
	return Ret * Pos % Mod;
}
int main() {
	scanf("%d%lld", &N, &M); For(i, 1, N) scanf("%lld", &A[i]);
	For(i, 1, N - 1) Inv[i] = Pow(i, Mod - 2), Pos = Pos * Inv[i] % Mod;
	Ans = C(N + M - 1, N - 1);
	For(Sta, 1, Pow(2, N) - 1) {
		LL t = 1, k = 0;
		For(i, 1, N) if(Sta >> (i - 1) & 1) t += 1 + A[i], ++k;
		if(k & 1) Ans = (Ans - C(N + M - t, N - 1)) % Mod;
		else Ans = (Ans + C(N + M - t, N - 1)) % Mod;
	}
	printf("%lld\n", (Ans + Mod) % Mod);
	return 0;
}

#include<cstdio>
#include<cstdlib>
#define LL long long
#define MOD 1000000007

LL n,fac_inv[25];
LL a[25];

inline LL C(LL x,LL y){
	LL ret=1;
	for(LL i=x;i>x-y;i--)ret=(ret*(i%MOD))%MOD;
	ret=(ret*fac_inv[y])%MOD;
	return ret;
}
LL solve(LL x,LL s)
{
	if(s<0)return 0;
	if(x==(n+1))return C(s+n-1,n-1);
	return (solve(x+1,s)-solve(x+1,s-a[x]-1)+MOD)%MOD;
}
inline LL power(LL x,LL y){
	LL ret=1;
	for(;y;y>>=1,x=(x*x)%MOD)
	if(y&1)ret=(ret*x)%MOD;
	return ret;
}
int main()
{
	LL s;LL value=1;
	for(LL i=1;i<=20;i++)value=value*i%MOD;
	fac_inv[20]=power(value,MOD-2);
	for(LL i=19;i+1;i--)fac_inv[i]=(fac_inv[i+1]*(i+1))%MOD;

	scanf("%I64d%I64d",&n,&s);
	for(LL i=1;i<=n;i++)scanf("%I64d",&a[i]);
	printf("%I64d\n",solve(1,s));
	return 0;
}

#include <bits/stdc++.h>
#include <random>
using namespace std;
constexpr long long mod = 1e9 + 7;
constexpr int md = (int)1e9 + 7; // 模数定义

inline void add(int& a, int b) {
	a += b;
	if (a >= md) a -= md;
}

inline void sub(int& a, int b) {
	a -= b;
	if (a < 0) a += md;
}

inline int mul(int a, int b) {
	return (int)((long long)a * b % md);
}

inline int powmod(int a, long long b) {
	int res = 1;
	while (b > 0) {
		if (b & 1) res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

inline int inv(int a) {
	a %= md;
	if (a < 0) a += md;
	int b = md, u = 0, v = 1;
	while (a) {
		int t = b / a;
		b -= t * a; swap(a, b);
		u -= t * v; swap(u, v);
	}
	assert(b == 1);
	if (u < 0) u += md;
	return u;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n; cin >> n;
	long long k; cin >> k;
	vector<long long> a(n);
	for (auto& i : a) cin >> i;

	auto c = [&](long long n, long long m) -> int {
		if (n < 0 || m < 0 || n < m) return 0;
		if (m == 0) return 1;
		long long ans = 1LL;
		long long res = n - m;
		if (res > m) swap(res, m);
		for (long long i = m + 1; i <= n; i++) {
			ans = ans * (i % mod) % mod;
		}
		for (int i = 2; i <= res; i++) {
			ans = 1LL * ans * inv(i) % mod;
		}
		return (int)(ans % mod);
	};

	auto cal = [&](int num) -> int {
		vector<int> b(n, 0);
		for (int i = 0; i < num; i++) b[i] = 1;
		reverse(b.begin(), b.end());
		long long ans = 0;
		do {
			long long sum = k + n - num - 1;
			for (int i = 0; i < n; i++) {
				if (b[i]) {
					sum -= a[i];
				}
			}
			long long x = c(sum, n - 1);
			ans += x;
			ans %= mod;
		} while (next_permutation(b.begin(), b.end()));
		return (int)(ans % mod);
	};

	int u = c(n + k - 1, n - 1) , res = 0;
	for (int i = 1; i <= n; i++) {
		if (i & 1) {
			add(res, cal(i));
		} else {
			sub(res, cal(i));
		}
	}
	sub(u, res);
	cout << u;
	return 0;
}

#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <complex>
#include <ctime>
#include <iomanip>
#include <cassert>
#include <sstream>
#include <iterator>

using namespace std;

#define file "file"
#define mp make_pair
#define pb push_back
#define xx real()
#define yy imag()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef complex<double> point;

const int MAXN = 1e2 + 5;
const ll MOD = 1e9 + 7;

ll a[MAXN];

ll bin_pow(ll a,ll st){
	ll ans = 1;
	for(;st;st >>= 1ll){
		if(st&1){
			ans = (ans * a + MOD) % MOD;
		}
		a = (a * a + MOD) % MOD;
	}
	return ans;
}

ll inv(ll a){
	return bin_pow(a,MOD - 2);
}

void solve(){
	int n;
	ll s;
	cin >> n >> s;
	for(int i = 0;i < n;i++) cin >> a[i];
	ll f = 1;
	ll fr = 1;
	for(int i = 2;i < n;i++){
		f = (f * i + MOD) % MOD;
	}
	fr = (fr * inv(f) + MOD) % MOD;
	int bg = 1 << n;
	ll deg, cur;
	int sgn;
	ll ans = 0;
	for(int i = 0;i < bg;i++){
		deg = s;
		sgn = 1;
		for(int j = 0;j < n;j++){
			if(i & (1 << j)){
				deg -= a[j] + 1;
				sgn *= -1;
			}
		}
		if(deg < 0) continue;
		cur = 1;
		deg %= MOD;
		for(int j = 1;j < n;j++){
			cur = (cur * (deg + j) + MOD) % MOD;
		}
		cur = (cur * fr + MOD) % MOD;
		ans = (ans + cur * sgn + MOD) % MOD;
	}
	cout << ans;
}

int main()
{
	//assert(freopen(file".in","r",stdin)); assert(freopen(file".out","w",stdout));
	#ifndef ONLINE_JUDGE
	assert(freopen("input.txt","r",stdin));
	assert(freopen("output.txt","w",stdout));
	#endif
	int t = 1;
	while(t--){
		solve();
	}
	return 0;
}

/* Supto
   Dept. Of CSE
   University Of Dhaka
*/
#include<bits/stdc++.h>

#define pb push_back
#define ins insert
#define ff first
#define ss second
#define ll long long int
#define llu long long unsigned
#define sss stringstream
#define oss ostringstream
#define iss istringstream
#define pii pair<int,int>
#define _sq(x) ((x)*(x))
#define lcm(a,b) ((a)*((b)/gcd(a,b)))
#define mem(a) memset(a,0,sizeof(a))
#define _set(a) memset(a,-1,sizeof(a))
#define popcount(n) __builtin_popcount(n)
#define popcountl(n) __builtin_popcountll(n)
#define ctz(x) __builtin_ctz(x) //number of trailing zeroes in a digit
#define ctzl(x) __builtin_ctzll(x)
#define clz(x) __builtin_clz(x)
#define clzl(x) __builtin_clzll(x) //number of leading zeroes in a digit
//If Long Long (mask & (1LL << k))
#define check(mask, k) (mask & (1 << k))
#define set1(mask, k) (mask | (1 << k))
#define set0(mask ,k) (mask & (~(1<<k)))
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

using namespace std;
#define pi acos(-1.0)
#define inf (1<<30)
#define eps 1e-9
#define MAX 100005
#define MAXL 15

const ll mod = 1000000007;
//int dx[] = {0,0,1,-1};
//int dy[] = {1,-1,0,0};
//int dx[] = {-1,-1,-1,0,0,1,1,1};
//int dy[] = {-1,0,1,-1,1,-1,0,1};

ll f[25], inv[30];
ll bigmod(ll a, ll x, ll m)
{
    ll res = 1LL;
    while(x > 0)
    {
        if(x&1LL) res = (res*a)%m;
        a = (a*a)%m;
        x /= 2;
    }
    return res;
}
void gen()
{
    inv[0] = inv[1] = 1LL;
    for(ll i = 2; i < 30; i++) inv[i] = bigmod(i, mod-2, mod);
}
ll nCr(ll n, ll r)
{
    if(r > n) return 0;
    if(n == r) return 1LL;
    ll d1 = n-r;
    ll d2 = r;
    if(d1 < d2) swap(d1, d2);
    ll res = 1LL;
    for(ll i = d1+1, j = 2; i <= n; i++, j++)
    {
        res = (res*(i%mod))%mod;
        if(j <= d2) res = (res*inv[j])%mod;
    }
    return res;
}
int main()
{
    //READ("input.txt");
    //WRITE("output.txt");
    ios_base::sync_with_stdio(false);
    gen();
    int n, i, j;
    ll s;
    cin >> n >> s;
    for(i = 0; i < n; i++) cin >> f[i];
    ll ans = 0;
    int lim = 1<<n;
    for(i = 0; i < lim; i++)
    {
        int cnt = 0;
        ll sum = s;
        for(j = 0; j < n; j++)
        {
            if(i&(1<<j))
            {
                sum -= (f[j]+1);
                cnt++;
            }
        }
        if(sum < 0) continue;
        ll tmp = nCr(sum+n-1, n-1);
        if(cnt&1) tmp = -tmp;
        ans = (ans + tmp)%mod;
        if(ans < 0) ans += mod;
        //cout << ans << "\n";
    }
    cout << ans << "\n";
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;
const int N = 22;

int fact[N];

int inverse(int64_t a) {
    int p = MOD - 2;
    int64_t res = 1;
    while (p > 0) {
        if (p & 1) res = res * a % MOD;
        a = a * a % MOD;
        p >>= 1;
    }
    return res;
}

int C(int64_t n, int k) { // small k
    if (k < 0 || k > n) return 0;
    int res = inverse(fact[k]);
    for (int i = 0; i < k; ++i) res = 1LL * res * ((n - i) % MOD) % MOD;
    return res;
}

using Poly = map<int64_t, int>;

Poly operator * (const Poly &a, const Poly &b) {
    Poly c;
    for (auto p : a) for (auto q : b) {
        c[p.first + q.first] += p.second * q.second;
    }
    return c;
}

int main() {
    fact[0] = 1;
    for (int i = 1; i < N; ++i) fact[i] = 1LL * fact[i - 1] * i % MOD;

    int n; int64_t s;
    cin >> n >> s;
    vector<int64_t> f(n);
    for (int i = 0; i < n; ++i) cin >> f[i];

    Poly a;
    a[0] = 1;

    for (int i = 0; i < n; ++i) {
        Poly b;
        b[0] = 1;
        b[f[i] + 1] = -1;
        a = a * b;
    }

    int res = 0;
    for (auto it : a) {
        res += 1LL * (it.second + MOD) % MOD * C(n + s - it.first - 1, n - 1) % MOD;
        res %= MOD;
    }

    cout << res << endl;

    return 0;
}

#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
namespace orz{
const int N=22;
const long long MOD=1000000007;
long long sum=0,color[N],inv[N];
int cnt[(1<<N)+1];
inline long long read(){
    long long a=1,b=0;char t;
    do{t=getchar();if(t=='-')a=-1;}while(t>'9'||t<'0');
    do{b=b*10-'0'+t;t=getchar();}while(t>='0'&&t<='9');
    return a*b;
}
inline long long pow(long long x,long long y){
    long long ans=1;
    while(y){
        if(y&1)ans=(ans*x)%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return ans%MOD;
}
inline long long C(long long n,long long m){
    if(n<m)return 0;
    long long res=1;
    for(long long i=n;i>n-m;--i)
        res=res*i%MOD;
    return res*inv[m]%MOD;
}
long long lucas(long long n,long long m){
    if(!m)return 1;
    return C(n%MOD,m%MOD)*lucas(n/MOD,m/MOD)%MOD;
}
inline long long CNT(int n,long long s){
    int m=1<<n;
    long long t=0,ans=0;
    for(int i=1;i<m;++i)
        cnt[i]=cnt[i>>1]+(i&1);
    ans=(lucas(s+n-1,n-1));
    for(int i=1;i<m;++i){
        t=0;
        for(int j=1;j<=n;++j)
            if((i>>(j-1))&1)t+=color[j];
        t+=cnt[i];
        if(t>s)continue;
        switch(cnt[i]&1){
            case 1:
                ans=(ans-lucas(s-t+n-1,n-1))%MOD;
                break;
            case 0:
                ans=(ans+lucas(s-t+n-1,n-1))%MOD;
                break;
        }
    }
    return (ans+MOD)%MOD;
}
int QAQ(){
    int n=read();long long s=read(),res=1;
    for(int i=1;i<=n;++i)
        res=res*i%MOD,inv[i]=pow(res,MOD-2);
    for(int i=1;i<=n;++i)
        color[i]=read();
    cout<<CNT(n,s);
    return false;
}
}
int main(){
    return orz::QAQ();
}

#include <iostream>
#include <vector>
#include <stdio.h>
#include <math.h>
typedef long long LL;
#define vi vector<LL>
#define vbool vector<bool>
#define mod 1000000007
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)

using namespace std;
LL n,s,ans = 0;
vi A;
vbool B;
/*
LL modPow(LL num,LL b){
    LL num2 = 1;
    while(b){
        if(b&1)
            num2 = (num2 * num)%mod;
        num = (num*num)%mod;
        b >>= 1;
    }
    return num2;
}
LL nCr(LL k, LL r){
    if(k < r)
        return 0;
    else if (k == r)
        return 1;
    LL tot = 1;
    for(LL i = k;i>k-r;i--){
        tot = (i * tot)%mod;
    }

    LL det = 1;
    for(LL i = 1;i<=r;i++){
        det = (det * i)%mod;
    }

    det = modPow(det,mod-2);
    tot = (det * tot)%mod;
    return tot;
}
*/

LL f[22], inv[55];

LL nCr(LL n, LL r) {
      if (r > n) return 0;
      if (n - r < r) r = n - r;
      n %= mod;
      LL ans = 1;
      REP(i, r) {
            ans = (ans * (n - i)) % mod;
            ans = (ans * inv[i + 1]) % mod;
      }
      return ans;
}

LL modpow(LL a, LL b) {
      LL res = 1;
      while (b) {
            if (b & 1) res = (res * a) % mod;
            a = (a * a) % mod;
            b >>= 1;
      }
      return res;
}

void pre() {
      for (int i = 1; i <= 50; i++) {
            inv[i] = modpow(i, mod - 2);
      }
}

void rec(LL now = 0){
    if(now == n){
        //check
        LL new_s = s;
        LL used = 0;
        for(LL i = 0;i<n;i++){
            if(B[i]){
                new_s -= (A[i] + 1);
                used++;
            }
        }
        if(new_s < 0)
            return;
        LL sum = nCr(new_s + n - 1,n-1); // do nCr method
        if(used & 1) sum = (2*mod-sum)%mod;
        ans = (sum + ans) % mod;
        if(ans < 0) ans += mod;
    }
    else{
        B[now] = true;
        rec(now+1);
        B[now] = false;
        rec(now+1);
    }
}

int main(){
    pre();
    cin >> n >> s;
    A.resize(n);
    B.resize(n);
    for(LL i = 0;i<n;i++) cin >> A[i];

    rec();

    cout << ans << endl;
    return 0;
}

#include <cstdio>

using namespace std;

const int N = 30;
const int mod = 1e9 + 7;

long long n, s, ans;
long long a[N];

inline long long qpow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1)	res = res * a % mod;
		a = a * a % mod, b >>= 1;
	}
	return res;
}

inline long long C(long long a, long long b) {
	long long fz = 1, fm = 1;
	for (long long i = a - b + 1; i <= a; ++i)	fz = fz * (i % mod) % mod;
	for (long long i = 2; i <= b; ++i)	fm = fm * i % mod;
	return fz * qpow(fm, mod - 2);
}

int main() {

	scanf("%I64d%I64d", &n, &s);
	for (int i = 1; i <= n; ++i)	scanf("%I64d", a + i);

	ans = C(s + n - 1, n - 1);

	long long S = (1 << n) - 1;
	for (long long P = S; P; P = (P - 1) & S) {
		long long sum = 0, pd = 0;
		for (int i = 0; i < n; ++i)
			if ((1 << i) & P)	sum += a[i + 1] + 1, ++pd;
		if (s < sum)	continue;
		if (pd & 1)	(ans = ans + mod - C(s + n - sum - 1, n - 1) % mod) %= mod;
		else (ans = ans + C(s + n - sum - 1, n - 1)) %= mod;
	}

	printf("%I64d\n", ans);

	return 0;
}

#include <iostream>
#include <vector>
#include <queue>
#include <fstream>
#include <functional>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstring>
#include <stack>
#include <map>
#include <set>

#define rep(i,a,b) for (int i = a; i <= b; i++)
#define repd(i,a,b) for (int i = a; i >= b; i--)
#define int64 long long
#define mp make_pair

using namespace std;

#ifdef _DEBUG
    const int N = 1000;
#else
    const int N = 3000000;
#endif

const int inf = 2e9;
const int64 MOD = 1e9+7;

int n;
int64 s, f[N], p[N];

int64 inv(int64 x)
{
    int64 res = 1, base = x, pow = MOD - 2;
    while (pow)
    {
        if (pow & 1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        pow >>= 1;
    }
    return res;
}

int64 C(int64 n, int64 k)
{
    int64 res = inv(p[k]);
    int64 i = n - k + 1;
    while (true)
    {
        if (i > n) break;
        res = (res * (i % MOD)) % MOD;
        i++;
    }
    return res;
}

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    scanf("%d%I64d", &n, &s);
    rep(i,0,n-1) scanf("%I64d", &f[i]);
    p[0] = 1;
    rep(i,1,100) p[i] = (p[i - 1] * i) % MOD;
    int64 ans = C(s + n - 1, n - 1);
    rep(mask,1,(1<<n)-1)
    {
        int k = 0;
        rep(j,0,20)
            if (mask & (1 << j)) k++;
        int64 r = 0;
        rep(j,0,n-1)
            if (mask & (1 << j)) r += f[j] + 1;
        if (s - r < 0) continue;
        if (k % 2) ans = (ans + MOD - C(s - r + n - 1, n - 1)) % MOD;
        else ans = (ans + C(s - r + n - 1, n - 1)) % MOD;
    }
    cout << ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 27;
const ll mod = 1e9 + 7;

ll modpow(ll x, ll p) {
  ll res = 1;
  while (p) {
    if (p%2) {
      res *= x;
      res %= mod;
      res = (res+mod)%mod;
    }
    x = x * x;
    x %= mod;
    x = (x+mod)%mod;
    p = p / 2;
  }
  return res%mod;
}

map<ll,ll> cache;

ll inv(ll x) {
  if (cache.count(x)) return cache[x];
  return cache[x] = modpow(x, mod-2);
}

// k is small
// (n k) = n*(n-1)*..*(n-k+1) / k!
ll nck(ll n, ll k) {
  assert(n>=0 && k>=0);
  ll res = 1;
  for (ll x=n; x>=n-k+1; x--) {
    res *= (x%mod);
    res %= mod;
    res = (res+mod)%mod;
  }
  for (ll x=k; x>=1; x--) {
    res *= inv(x);
    res %= mod;
    res = (res+mod)%mod;
  }
  return res;
}

int n;
ll x, f[maxn];

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

  cin>>n>>x;
  for (int i=0; i<n; i++) {
    cin>>f[i];
  }

  assert(nck(4,2)==6);
  assert(modpow(2,5)==32);

  ll ans = 0;

  // PIE: let A[i] = # of ways s.t. x_i > F[i]
  // we are interested in the complement of this (aka all valid configs)
  // where a valid config is x_i <= F[i] for all i.
  for (int mask=0; mask<(1<<n); mask++) {
    ll left = x;
    for (int i=0; i<n; i++) {
      if ((mask>>i)&1) {
	left -= (f[i]+1);
      }
    }
    if (left < 0) continue;

    ll cur = nck(left + n - 1, n - 1); // stars and bars

    int bits = __builtin_popcount(mask);
    if (bits%2==0) {
      ans += cur;
    } else {
      ans -= cur;
    }
    ans %= mod;
    ans = (ans + mod)%mod;
  }

  cout<<ans<<endl;
  return 0;
}

#include <cstdio>
typedef long long LL;
const LL MaxN = 10000000;
const LL Mod = 1e9 + 7;
LL Fac[MaxN];
void Init() {
	for(LL i = 1; i <= MaxN - 1; i++) Fac[i] = (Fac[i - 1] * i) % Mod;
}
LL Pow(LL A, LL B) {
	LL Ans = 1, Base = A;
	while(B) {
		if(B & 1) Ans = Ans * Base % Mod;
		Base = Base * Base % Mod;
		B >>= 1;
	}
	return Ans % Mod;
}
LL Calc(LL N, LL K, LL Mod) {
	if(N < K) return 0;
	if(K > N - K) K = N - K;
	LL A = 1, B = 1;
	for(int i = 0; i < K; i++) {
		A = A * (N - i) % Mod;
		B = B * (i + 1) % Mod;
	}
	return A * Pow(B, Mod - 2) % Mod;
}

LL Lucas(LL N, LL M) {
	if(!M) return 1;
	else return Calc(N % Mod, M % Mod, Mod) * Lucas(N / Mod, M / Mod);
}
LL N, M, S; LL F[MaxN];
LL Ans = 0;
LL K;
int main() {
	scanf("%lld%lld", &K, &S);
	LL N = K;
	Fac[0] = 1;
	for(LL i = 0; i < N; i++) scanf("%lld", &F[i]);
	for(LL i = 0; i < (1 << N); i++) {
		LL Sum = S; LL Flag = 1;
		for(LL j = 0; j < N; j++)
			if(i & (1 << j)) {
				Sum -= F[j] + 1;
				Flag *= -1;
			}
			if(Sum < 0) continue;
		Ans += Flag * Lucas(Sum + N - 1, N - 1) % Mod;
		Ans %= Mod;
	}
	printf("%lld", (Ans + Mod) % Mod);
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string.h>
#include<math.h>
using namespace std;

typedef long long LL;

LL n,m,p=1e9+7,s;

long long f[30];
LL quick_mod(LL a, LL b)
{
    LL ans = 1;
    a %= p;
    while(b)
    {
        if(b & 1)
        {
            ans = ans * a % p;
            b--;
        }
        b >>= 1;
        a = a * a % p;
    }
    return ans;
}

LL C(LL n, LL m)
{
    if(m > n) return 0;
    if(m>n-m)m=n-m;
    LL ans = 1;
	LL b=1;
	LL a=1;
    for(int i=1; i<=m; i++)
    {
        a = a%p*(n + i - m) % p;
        b =b * i % p;
    }
    ans = ans * (a * quick_mod(b, p-2) % p) % p;
    return ans;
}

LL Lucas(LL n, LL m)
{
    if(m == 0) return 1;
    return C(n % p, m % p) * Lucas(n / p, m / p) % p;
}

int main()
{
	scanf("%I64d%I64d",&n,&s);
	long long ans=0;
	for(int i=1;i<=n;i++)scanf("%I64d",f+i);
	long long sta=1<<n;
	for(int i=0;i<sta;i++)  //压位，枚举是否超出
	{
		long long sum=s;
		long long flag=1;
		for(int j=1;j<=n;j++)
		if(i>>(j-1)&1==1)
		{
			sum-=f[j]+1;  //把空的情况也要减掉，所以加一，这样才是它超出的情况
			flag=flag*-1;
		}
		if(sum<0)continue;
		ans=(ans+flag*Lucas(sum+n-1,n-1))%p;
	}
	ans=(ans+p)%p;
	printf("%I64d\n",ans);
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9 + 7;

ll inv (ll n) {
    ll ans = 1;
    ll power = mod - 2;
    while (power) {
        if (power & 1) ans = ans * n % mod;

        power /= 2;
        n = n * n % mod;
    }

    return ans;
}

ll small_inv [30];

// n <= 20
ll stars_and_bars (ll sum, ll n) {
    ll ans = 1;
    for (ll a = sum + 1; a <= sum + n - 1; a++) ans = ans * (a % mod) % mod;

    for (ll a = 1; a <= n - 1; a++) ans = ans * small_inv[a] % mod;

    return ans;
}

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    for (int a = 1; a < 30; a++) small_inv[a] = inv (a);

    ll n, s;
    cin >> n >> s;

    vector<ll> f(n);
    for (ll &fi : f) cin >> fi;

    ll ans = 0;
    for (int state = 0; state < (1 << n); state++) {
        bool is_neg = false;
        ll tot = 0;
        for (int a = 0; a < n; a++) {
            if (state & (1 << a)) {
                is_neg ^= true;
                tot += f[a] + 1;
            }
        }

        if (tot <= s) {
            ll tmp = stars_and_bars (s - tot, n);
            // cout << "[x^" << s - tot << "]A = " << tmp << endl;
            ans += (is_neg ? -1 : 1) * tmp;
            ans = (ans % mod + mod) % mod;
        }
    }

    cout << ans;
}

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define ld long double
#define PB push_back
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define pii pair <int,  int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const ll maxn = 30 + 10 , mod = 1e9 + 7 , INF = 1e18 , lg = 22;

ll n , s , f[maxn] , inv[maxn] , fac[maxn] , ans;

inline ll power(ll a , ll b) {
    ll res = 1;
    while(b) {
        if(b & 1) {
            res = (res * a) % mod;
        }
        a = (a * a) % mod;
        b /= 2;
    }
    return res;
}

inline ll get(ll a , ll aa , ll b) {
    ll res = 1;
    for (ll i = a; i <= aa; ++i) {
        res = (res * (i % mod)) % mod;
    }
    res = (res * inv[b]) % mod;
    return res;
}

int main() {
    inv[0] = fac[0] = 1;
    for (int i = 1; i < maxn; ++i) {
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = power(fac[i] , mod - 2);
    }

    cin >> n >> s;
    for (int i = 0; i < n; ++i) {
        cin >> f[i];
    }

    for (ll mask = 0; mask < (1ll << n); ++mask) {
        ll cnt = __builtin_popcountll(mask) , zarib = 1 , k = s;
        if(cnt & 1) {zarib = -1;}
        for (ll i = 0; i < lg; ++i) {
            if(mask & (1ll << i)) {
                k -= f[i] + 1;
            }
        }
        if(k >= 0) {
            ans = (ans + zarib * get(k + 1 , k + n - 1 , n - 1)) % mod;
            ans += mod; ans %= mod;
        }
    }
    cout << ans << '\n';
}

#include <bits/stdc++.h>

#define vi vector<int>
#define pb push_back
#define si set<int>
#define pii pair<int, int>
#define mp make_pair

#define foreach(it, tem) for(auto it : tem)
#define rep3(i, st, n, step) \
for(__typeof(st) i = (st); i < (n); i += step)
#define rep2(i, st, n) rep3(i, st, n, 1)
#define rep(i, n) rep2(i, 0, n)

#ifdef DEBUG
#define watch(i) cerr << #i << " = " << i << endl
#define add_log(i) cerr << i << endl
#else
#define watch(i)
#define add_log(i)
#endif // DEBUG
#define MOD 1000000007
#define MAX_N 2048
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double LF;
typedef double DB;
ll arr[MAX_N];
ll inv[MAX_N], fact[MAX_N];
ll quick_pow(ll a, ll n)
{
    if (!n)
    {
        return 1;
    }
    if (n == 1)
    {
        return a;
    }
    ll ans = 1;
    if (n & 1)
    {
        ans = a;
        n ^= 1;
    }
    ll res = quick_pow(a, n >> 1);
    ans = ans * res % MOD * res % MOD;
    return ans;
}
void get_inv(int n)
{
    fact[0] = 1;
    inv[0] = 1;
    inv[1] = 1;
    for (int i = 1; i <= n; i++)
    {
        fact[i] = fact[i - 1] * i % MOD;
    }
    for (int i = 2; i <= n; i++)
    {
        inv[i] = quick_pow(fact[i], MOD - 2);
    }
}
ll C(ll n, ll m)
{
    if (n < m)
    {
        return 0;
    }
    if (m > n - m)
    {
        m = n - m;
    }
    ll ans = inv[m];
    for (int i = 1; i <= m; i++)
    {
        ans = ans * (n - i + 1) % MOD;
    }
    return ans;
}
ll lucas(ll n, ll m)
{
    if (!m)
    {
        return 1;
    }
    return lucas(n / MOD, m / MOD) * C(n % MOD, m % MOD) % MOD;
}
int main()
{
    ios::sync_with_stdio(false);
    int n;
    ll s;
    cin >> n >> s;
    get_inv(n);
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    ll ans = 0;
    for (int i = 0; i < (1 << n); i++)
    {
        ll s2 = s;
        int cnt = 0;
        for (int j = 0; j < n; j++)
        {
            if (i & (1 << j))
            {
                s2 -= arr[j] + 1;
                if (s2 < 0)
                {
                    break;
                }
                cnt++;
            }
        }
        if (s2 < 0)
        {
            continue;
        }
        ll res = lucas(s2 + n - 1, n - 1);
        ll sign;
        if (cnt & 1)
        {
            sign = -1ll;
        }
        else
        {
            sign = 1ll;
        }
        ans = (ans + sign * res + MOD) % MOD;
    }
    cout << ans << endl;
    return 0;
}

#include<cstdio>
typedef long long ll;
const int N=20,M=1e9+7;
inline int Mod(int a){return a<M?a:a-M;}
int n,invf[N],f[N],s,c;ll m,a[N],l;
inline int Pow(int a,int m){int s=1;for(;m;m>>=1)m&1?s=1ll*s*a%M:0,a=1ll*a*a%M;return s;}
inline void InC(){
	f[0]=1;
	for(int i=1;i<n;i++)f[i]=1ll*f[i-1]*i%M;
	invf[n-1]=Pow(f[n-1],M-2);
	for(int i=n-1;i;i--)invf[i-1]=1ll*invf[i]*i;
}
int C(ll n,int m){
	if(m>n||m<0)return 0;
	n%=M;
	if(m>n)return 0;
	int s=invf[m];
	for(int i=0;i<m;i++)s=1ll*s*(n-i)%M;
	return s;
}
int main()
{
	scanf("%d%lld",&n,&m);
	InC();
	for(int i=0;i<n;i++)scanf("%lld",a+i);
	for(int I=0;I<(1<<n);I++){
	  c=0;l=m;
	  for(int i=0;i<n;i++)
		if(I&1<<i)c++,l-=a[i]+1;
	  s=c&1?Mod(s-C(l+n-1,n-1)+M):Mod(s+C(l+n-1,n-1));
	}printf("%d",s);
	return 0;
}

#include<cstdio>

int n;
long long S,a[25],inv[25];
int ans;
int mo=1000000007;
long long qpow(long long a,long long b,long long mo)
{
	long long res=1,Pow=a;
	while(b)
	{
		if(b&1) res=res*Pow%mo;
		Pow=Pow*Pow%mo;
		b>>=1;
	}
	return res;
}
long long C(long long x,int y)
{
	long long res=1;
	for(int i=1;i<=y;i++)
		res=res*((x-i+1)%mo)%mo*inv[i]%mo;
	return res;
}
void dfs(int x,long long S,int cnt)
{
	if(S<0) return;
	if(x==n+1)
	{
		ans+=1LL*(cnt&1?-1:1)*C(S+n-1,n-1);
		ans=(ans%mo+mo)%mo;
//		printf("%lld\n",ans);
		return;
	}
	dfs(x+1,S,cnt);
	dfs(x+1,S-a[x]-1,cnt+1);
}
int main()
{
	scanf("%d%lld",&n,&S);
	for(int i=1;i<=n;i++) inv[i]=qpow(i,mo-2,mo);
	long long sum=0;
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]),sum+=a[i];
	dfs(1,S,0);
	if(sum<S) return !printf("0");
	printf("%d\n",ans);
}

#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define MAXN 20

long long IF[MAXN + 1];

long long modpow(long long x, long long n)
{
    long long P = 1;

    while(n)
    {
        if(n & 1) P = P * x % MOD;

        n >>= 1;
        x = x * x % MOD;
    }

    return P;
}

long long getC(long long n, long long k)
{
    if(n < k) return 0;

    long long x = IF[k];
    for(int i=1; i<=k; i++)
        x = x * ((n - i + 1) % MOD) % MOD;
    return x;
}

int main()
{
    IF[0] = 1;
    for(int i=1; i<=MAXN; i++)
        IF[i] = IF[i-1] * modpow(i, MOD - 2) % MOD;

    int n;
    long long s;
    while(cin>>n>>s)
    {
        long long F[n];
        for(int i=0; i<n; i++)
            cin>>F[i];

        long long ans = 0;

        for(int mask=0; mask<(1<<n); mask++)
        {
            int cnt = __builtin_popcount(mask);

            long long sum = 0;
            for(int i=0; i<n; i++)
                if(mask & (1<<i))
                    sum += F[i];

            long long cur = getC(s+n-1-sum-cnt, n-1);
            if(cnt % 2 == 1) ans = (ans - cur) % MOD;
            else ans = (ans + cur) % MOD;
        }

        cout<<(ans < 0 ? ans + MOD : ans)<<endl;
    }

    return 0;
}

#include <iostream>
#define ll long long
using namespace std;
const int N = 26, P = 1000000007;
ll a[N];
int inv[N]; //逆元

int ksm(int a, int b) //快速幂
{
	int ans = 1;
	while(b != 0)
	{
		if(b & 1) //奇数
			ans = (ll)ans * a % P;
		a = (ll)a * a % P;
		b >>= 1;
	}
	return ans;
}

int C(ll y, int x) //y个数选x个
{
	if(y < 0 || x < 0 || y < x)
		return 0;
	y %= P;
	if(y == 0 || x == 0)
		return 1;
	int ans = 1;
	for(int i = 0; i < x; i++) //计算y! / (y-x)!
		ans = (ll)ans * (y - i) % P;
	for(int i = 1; i <= x; i++) //计算 ans / x!, 转化成乘以 1到x的逆元
		ans = (ll)ans * inv[i] % P;
	return ans;
}

int main()
{
	int n;
	ll s;
	cin >> n >> s;
	for(int i = 1; i <= n; i++) //输入
		cin >> a[i];

	for(int i = 1; i <= 20; i++) //快速幂求i的逆元（费马小定理）
		inv[i] = ksm(i, P - 2);

	ll ans = 0, res = C(n + s - 1, n - 1); //利用组合数公式求总数
	for(int x = 1; x < (1 << n); x++) //容斥，枚举一个、两两、三三……之间的交集
	{
		ll t = n + s - 1; // n 加上s-1个隔板，总共n+s-1个物品
		int cnt = 0; //统计二级制数位上的1，也就是找有几个集合并， 由此决定正负
		for(int i = 1; i <= n; i++) //枚举数位
		{
			if((x >> (i-1)) & 1)
			{
				++cnt;
				t -= a[i] + 1; //第i种物品至少选a[i]+1个，那么剩下的就只需要选 t-a[i]-1个
			}
		}
		if(cnt & 1) //有奇数项参与 交
			ans = (ans + C(t, n - 1)) % P;
		else
			ans = (ans - C(t, n - 1)) % P;
	}
	cout << (res - ans + P) % P << endl; //因为s可能超过花的总数，导致res-ans可能为负，要加P
	return 0;
}

#include<cstdio>
#include<cstdlib>
#define LL long long
#define MOD 1000000007

LL n,fac_inv[25];
LL a[25];

inline LL C(LL x,LL y){
	LL ret=1;
	for(LL i=x;i>x-y;i--)ret=(ret*(i%MOD))%MOD;
	ret=(ret*fac_inv[y])%MOD;
	return ret;
}
LL solve(LL x,LL s)
{
	if(s<0)return 0;
	if(x==(n+1))return C(s+n-1,n-1);
	return (solve(x+1,s)-solve(x+1,s-a[x]-1)+MOD)%MOD;
}
inline LL power(LL x,LL y){
	LL ret=1;
	for(;y;y>>=1,x=(x*x)%MOD)
	if(y&1)ret=(ret*x)%MOD;
	return ret;
}
int main()
{
	LL s;LL value=1;
	for(LL i=1;i<=20;i++)value=value*i%MOD;
	fac_inv[20]=power(value,MOD-2);
	for(LL i=19;i+1;i--)fac_inv[i]=(fac_inv[i+1]*(i+1))%MOD;

	scanf("%I64d%I64d",&n,&s);
	for(LL i=1;i<=n;i++)scanf("%I64d",&a[i]);
	printf("%I64d\n",solve(1,s));
	return 0;
}

//@winlere
#include<bits/stdc++.h>
#define int long long
using namespace std;  typedef long long ll;
template < class ccf > inline ccf qr(ccf ret){      ret=0;
      register char c=getchar();
      while(not isdigit(c)) c=getchar();
      while(isdigit(c)) ret=ret*10+c-48,c=getchar();
      return ret;
}inline int qr(){return qr(1);}
const int maxn=25;
const ll mod=1e9+7;
inline ll Pow(ll base,ll p){
      base%=mod;
      register ll ret=1;
      for(;p;p>>=1,base=base*base%mod)
	    if(p&1) ret=ret*base%mod;
      return ret;
}
ll data[maxn],s,ans,inv[maxn]={1},jie[maxn]={1};
int n;

inline ll C(const ll&n,const ll&m){
      if(n<m||m<0||n<0)return 0;
      if(n==m)return 1;
      register ll ret=inv[m];
      for(register ll t=n;t>=n-m+1ll;--t)
	    ret=t%mod*ret%mod;
      return ret;
}
#undef int
int main(){
#define int long long
#ifndef ONLINE_JUDGE
      freopen("in.in","r",stdin);
      //freopen("out.out","w",stdout);
#endif
      for(register int t=1;t<maxn;++t)
	    inv[t]=inv[t-1]*Pow(t,mod-2ll)%mod;
      n=qr();s=qr(1ll);ans=C(s+n-1ll,n-1ll);
      for(register int t=1;t<=n;++t)
	    data[t]=qr(1ll);
      for(register int t=1,edd=1<<n,cnt=0;t<edd;++t){
	    ll f=cnt=0,delt;
	    for(register int i=1;i<=n;++i)
		  if(t<<1>>i&1)
			f+=data[i]+1ll,++cnt;
	    delt=C(s-f+n-1ll,n-1ll);
	    if(cnt&1) ans=(ans-delt)%mod,ans=ans<0?ans+mod:ans;
	    else ans=(ans+delt)%mod;
      }
      cout<<ans<<endl;
      return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

long long ans;
long long f[21], s;
int n;
const long long Mod = 1000000007;
long long inv[21];

long long fastmul(long long x, long long b)
{
    long long ret = 1;
    x %= Mod;
    while(b)
    {
        if(b & 1) ret = ret * x % Mod;
        x = x * x % Mod, b >>= 1;
    }
    return ret;
}

long long C(long long n, long long m)
{
    long long ret = 1;
    for(long long a = n - m + 1; a <= n; ++a)
    {
        ret = ret * (a % Mod) % Mod;
    }
    ret = ret * (inv[m]) % Mod;
    return ret;
}

long long calc(int msk){
    long long S = s;
    for(int i = 0; i < n; ++i)
        if((msk >> i) & 1)
            S -= f[i] + 1;
    if(S < 0) return 0;
    return C(S + n - 1, n - 1);
}

void prepare(){
    inv[0] = inv[1] = 1;
    long long ss = 1;
    for(int i = 2; i <= 20; ++i){
        ss = ss * i % Mod;
        inv[i] = fastmul(ss, Mod - 2);
    }
}

int main()
{
    prepare();
    ans = 0;
    cin >> n >> s;
    long long sum = 0;
    for(int i = 0; i < n; ++i)
        cin >> f[i], sum += f[i];
    if(sum < s){
        printf("0\n");
        return 0;
    }
    for(int i = 0; i < (1 << n); ++i){
        int cnt = __builtin_popcount(i);
        ans = (ans + (cnt&1?-calc(i):calc(i))) % Mod;
        while(ans < 0) ans += Mod;
    }
    ans %= Mod, ans += Mod, ans %= Mod;
    cout << ans << endl;
    return 0;
}

#include<bits/stdc++.h>
#define int long long
int k,r,n[40];
int inv[40];
const int mod=1000000007;
int pow(int a,int b){
	int ret=1;
	while(b){
		if(b&1)ret=ret*a%mod;
		a=a*a%mod;b>>=1;
	}
	return ret;
}
int C(int y,int x){
    if (y<0||x<0||y<x) return 0;
    y%=mod;
    if (y==0 || x==0) return 1;
    int ans=1;
    for (int i=0;i<x;i++)
        ans=ans*(y-i)%mod;
    for (int i=1;i<=x;i++)
        ans=ans*inv[i]%mod;
    return ans;
}
signed main(){
	inv[1]=1;
    for(int i=2;i<40;i++)
        inv[i]=inv[mod%i]*(mod-mod/i)%mod;
	std::cin>>k>>r;
	for(int i=1;i<=k;i++)
		std::cin>>n[i];
	int ans=C(k+r-1,k-1);
	for(int S=1;S<(1<<k);S++){
		//枚举所有状态
		int tmp=k+r,num=0;
        for(int i=0;i<k;i++)
            if((S>>i)&1)
				num++,tmp-=n[i+1];
        tmp-=num+1;
        if(num%2)ans=(ans-C(tmp,k-1))%mod;
        else ans=(ans+C(tmp,k-1))%mod;
        //printf("%d %d %d\n",num,tmp,ans);
	}
	std::cout<<(ans+mod)%mod;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
long long a[22],m,ans=0;
int inv[22],n;

// a^b
int q_pow(int a,int b){
	int c=1;
	for(;b;b>>=1){
		if(b&1)
			c=(long long)c*a%mod;
		a=(long long)a*a%mod;
	}
	return c;
}

// C(y,x)
int C(long long y,int x){
	if(y<0||x<0||y<x)
		return 0;
	y%=mod;
	if(y==0||x==0)
		return 1;
	int ans=1;
	for(int i=0;i<x;++i)
		ans=(long long)ans*(y-i)%mod;
	for(int i=1;i<=x;++i)
		ans=(long long)ans*inv[i]%mod;
	return ans;
}

int main(){
	for(int i=1;i<=20;++i)
		inv[i]=q_pow(i,mod-2);
	cin>>n>>m;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	for(int x=0;x<1<<n;++x){
		if(x==0){
			ans=(ans+C(n+m-1,n-1))%mod;
		}
		else{
			long long t=n+m;
			int p=0;
			for(int i=0;i<n;++i)
				if(x>>i&1){
					p++;
					t-=a[i+1];
				}
			t-=p+1;
			if(p&1)
				ans=(ans-C(t,n-1))%mod;
			else
				ans=(ans+C(t,n-1))%mod;
		}
	}
	cout<<(ans+mod)%mod;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll N = 22, MOD = 1000 * 1000 * 1000 + 7;

ll n, s, ans, a[N], sum[1 << N], LOG[1 << N];

int _sum(ll a, ll b) {
	return ((a + b) % MOD + MOD) % MOD;
	a += b;
	if(a >= MOD)
		a -= MOD;
	if(a < 0)
		a += MOD;
	return a;
}

int mul(ll a, ll b) {
	return 1LL * (a % MOD) * (b % MOD) % MOD;
}

int power(ll a, ll b) {
	ll res = 1;
	a %= MOD;
	while(b) {
		if(b & 1)
			res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}

int choose(int a, ll b) {//cerr << "choose " << a << ' ' << b << '\n';
	if(a > b)
		return 0;
	int res1 = 1, res2 = 1;
	for (ll i = 0; i < a; i++)
		res1 = mul(res1, b - i);
	for (ll i = 1; i <= a; i++)
		res2 = mul(res2, i);
	return mul(res1, power(res2, MOD - 2));
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	for (int i = 0; i < N - 1; i++)
		LOG[1 << i] = i;
	cin >> n >> s;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 1; i < (1 << n); i++)
		sum[i] = sum[i - (i & -i)] + a[LOG[i & -i]];
	ans = choose(n - 1, s + n - 1);
	for (int i = 1; i < (1 << n); i++) {
		if(__builtin_popcount(i) & 1)
			ans = _sum(ans, -choose(n - 1, s - sum[i] - __builtin_popcount(i) + n - 1));
		else
			ans = _sum(ans, choose(n - 1, s - sum[i] - __builtin_popcount(i) + n - 1));
	}
	cout << ans;
	return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

const int Mod = 1000000007;

#define ll long long

int n;
ll ans;
ll f[21], s;
ll inv[21];

ll bin_pow(ll x, ll b){
    ll ret = 1;
    x %= Mod;
    while(b){
        if(b & 1) ret = ret * x % Mod;
        x = x * x % Mod;
        b >>= 1;
    }
    return ret;
}

ll C(ll n, ll m){
    ll ret = 1;
    for(ll a = n - m + 1; a <= n; ++a)
        ret = ret * (a % Mod) % Mod;
    ret = ret * (inv[m]) % Mod;
    return ret;
}

ll calc(int msk){
    ll S = s;
    for(int i = 0; i < n; ++i)
        if((msk >> i) & 1)
            S -= f[i] + 1;
    if(S < 0) return 0;
    return C(S + n - 1, n - 1);
}

void prepare(){
    inv[0] = inv[1] = 1;
    ll ss = 1;
    for(int i = 2; i <= 20; ++i){
        ss = ss * i % Mod;
        inv[i] = bin_pow(ss, Mod - 2);
    }
}

int main(){
    prepare();
    ans = 0;
    cin >> n >> s;
    ll sum = 0;
    for(int i = 0; i < n; ++ i)
        cin >> f[i],
    	sum += f[i];
    if(sum < s){
        cout << 0;
        return 0;
    }
    for(int i = 0; i < (1 << n); ++ i){
        int cnt = __builtin_popcount(i);
        ans = (ans + (cnt&1 ? -calc(i) : calc(i))) % Mod;
        if(ans < 0) ans += Mod;
    }
    cout << (ans + Mod) % Mod<< endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
    ll f=1,x=0;
    char ch=getchar();
    while(ch<'0'||ch>'9')f=(ch=='-')?-1:1,ch=getchar();
    while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return x*f;
}
const ll mod=1e9+7;
ll f[50],mi[50],ans;
ll C(ll n,ll m){
    if(n<0||m<0||n<m)return 0;
    if(n%mod==0||m==0)return 1;
    ll res=1;
    for(ll i=n-m+1;i<=n;++i)
    res*=(i%mod),res%=mod;
    for(int i=1;i<=m;++i)
    res*=mi[i],res%=mod;
    return res;
}
ll fast_pow(ll b,ll k){
    ll res=1;
    while(k>0){
        if(k&1)res=(res*b)%mod;
        b=(b*b)%mod;
        k>>=1;
    }
    return res;
}
int main(){
    ll n=read(),s=read();
    for(ll i=1;i<=n;++i)f[i]=read();
    for(ll i=1;i<=20;++i)mi[i]=fast_pow(i,mod-2);
    ans=C(n+s-1,n-1)%mod;
    for(ll i=1;i<=(1<<n)-1;++i){
        ll k=n+s,p=0;
        for(ll j=0;j<n;++j)
        if((1<<j)&i)p++,k-=f[j+1];
        k-=p+1;
        if(p&1)ans-=C(k,n-1),ans%=mod;
        else ans+=C(k,n-1),ans%=mod;
    }
    printf("%lld",(ans+mod)%mod);
    return 0;
}

#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
//#define m(x)    (abs(x))>mod ? x%mod : x
using namespace std;
ll tc, cn=0, k, n;
ll a[25];
ll m(ll a)
{
    if(abs(a)>mod) a%=mod;
    return a;
}
ll inv[30];
ll ep(ll a, ll p)
{
	int x=a;
    if(inv[a]!=-1) return inv[a];
    ll res=1;
    while(p)
    {
        if(p&1) res=m(res*a);
        p/=2;
        a= m(a*a);
    }
    inv[x]=res;
    return inv[x];
}
ll ncr(ll n, ll r)
{
    if(n<r) return 0;
    ll res=1;
    for(ll i=0; i<r; i++)
    {
        res*=m(n-i);
        res=m(res);
    }
    for(ll i=2; i<=r; i++)
    {
        res*=ep(i,mod-2);
        res=m(res);
    }
    return res;
}

int main()
{
    memset(inv,-1,sizeof(inv));
    // cout<<ncr(7,2)<<endl;
    int i, j ;
    ll cnt, pp, rem, nn;
    cin>>k>>n;
    for(i=0; i<k; i++)
    {
        cin>>a[i];
    }

    for( i=0; i<k; i++)
    {
        if(a[i]>n) a[i]=n;
    }
    ll ans;
    if(n<0)
    {
        ans =0;
    }
    else
    {
        ans = ncr(n+k-1,k-1);
        int ran = 1<<k;
        for(i=1; i<(ran); i++)
        {
            cnt =0;
            pp  =0;
            for(j=0; j<k; j++)
            {
                if(i&(1<<j))
                {
                    pp+=a[j]+1;
                    cnt++;
                }
            }
            rem = k;
            nn = n -pp;
            if(n<0)
            {

            }
            else if(cnt&1)
            {
                ans -= ncr(nn+rem-1,rem-1);
            }
            else
            {
                ans += ncr(nn+rem-1,rem-1);
            }
        }
        ans = (ans)%mod;
        ans=(mod+mod+ans)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

/*
 * Author: fatboy_cw
 * Created Time:  2014/7/25 18:42:18
 * File Name: E.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}

typedef long long lint;
const lint MOD = 1000000007;
const int maxn = 25;
lint n, s, f[maxn], inv[maxn], ans;

lint POW(lint a, lint b, lint c) {
    if(b == 0) return 1LL;
    lint t = POW(a, b >> 1, c) % c;
    t = t * t % c;
    if(b & 1) return t * a % c;
    return t;
}

lint C(lint n, lint m) {
    lint res = 1;
    for(lint i = 0; i < m; i++) {
        res = res * (n - i) % MOD;
        res = res *  inv[i + 1] % MOD;
    }
    return res;
}

void dfs(int step, lint now, int sgn) {
    if(now < n - 1) return;
    if(step == n) {
        ans += sgn * C(now % MOD, n - 1);
        ans %= MOD;
        return;
    }
    dfs(step + 1, now, sgn);
    dfs(step + 1, now - f[step] - 1, sgn * -1);
}

void pre() {
    for(int i = 1; i < maxn; i++) {
        inv[i] = POW(i, MOD - 2, MOD);
    }
}

int main() {
    pre();
    cin >> n >> s;
    for(int i = 0; i < n; i++) cin >> f[i];
    dfs(0, n + s - 1, 1);
    cout << (ans + MOD) % MOD << endl;
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
const ll mod=1000000007;
ll a[22],m,ans=0;
ll inv[22],n;

ll work(ll a,ll b)//a^b
{
	ll c=1;
	for(;b;b>>=1)
	{
		if(b&1)	c=c*a%mod;
		a=a*a%mod;
	}
	return c;
}

ll C(ll y,ll x)//a/b=a*(b^-1)mod mod
{
	if(y<0 || x<0 || y<x)	return 0;
	y%=mod;
	if(y==0 || x==0)	return 1;
	ll anss=1;
	for(int i=0;i<x;i++)
		anss=anss*(y-i)%mod;
	for(int i=1;i<=x;i++)
		anss=anss*inv[i]%mod;
	return anss;
}

int main()
{
	for(int i=1;i<=20;i++)
		inv[i]=work(i,mod-2);//因为mod为质数，则i的乘法逆元为i^(mod-2)
	scanf("%lld %lld",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int x=0;x<=(1<<n)-1;x++)
	{
		if(x==0)
		{
			ans+=C(n+m-1,n-1);
			ans%=mod;
		}
		else
		{
			long long t=n+m;
			ll p=0;
			for(int i=0;i<n;i++)
			{
				if(x>>i&1)
				{
					p++;
					t-=a[i+1];
				}
			}
			t-=p+1;
			if(p&1)
				ans=ans-C(t,n-1);
			else
				ans=ans+C(t,n-1);
			ans%=mod;
		}
	}
	printf("%lld",(ans+mod)%mod);
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
int n,inv[30];
ll a[30],m,ans;
inline int qpow(int a, int p){
    int ans = 1;
    while(p){
        if(p&1) ans = (ll)ans*a %mod;
        p >>= 1;
        a = (ll)a*a % mod;
    }
    return ans%mod;
}
//C(y,x) ,y中选x个
inline int C(ll y, ll x){
    if(y<0 || x<0 || y<x) return 0; //根据定义0个方法
    y %= mod;
    if(y==0 || x==0) return 1;

    int ans = 1;
    for(int i = 0; i < x; i++)
        ans = (ll)ans * (y-i) %mod;
    for(int i = 1; i <= x; i++)
        ans = (ll)inv[i] * ans %mod;
    return ans;
}
int main(){
    for(int i = 1; i <= 20; i++) inv[i] = qpow(i,mod-2);
    //预处理出inv

    scanf("%d %lld",&n,&m);
    for(int i = 1; i <= n; i++) scanf("%lld",&a[i]);

    //快速枚举容斥原理中的各个组合
    for(int x = 0; x < 1<<n; x++) {
        ll t = n+m, p = 0;

        for(int i = 0; i < n; i++){
            if(x>>i & 1){
                p++;
                t -= a[i+1];
            }
        } //更新t和p

        t -= p+1;
        if(p&1){
            ans = (ll)(ans - C(t,n-1)) % mod;
        } else{
            ans = (ll)(ans + C(t,n-1)) % mod;
        }
    }

    printf("%lld",(ans+mod)%mod);
    return 0;
}

// c header
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <memory.h>
// c++ header
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long  ll;
typedef unsigned long long ull;

ll n,s;
ll f[25];

ll fac[20];

const ll P = 1e9  + 7 ;

ll GCD(ll a,ll b) {
    return b==0? a : GCD( b, a %b );
}

int prime[8]={2,3,5,7,11,13,17,19};
int factor[8];

void factorize(){
    fac[0] = 1;
    fac[1] = 1;
    for(int i=2;i<20;i++){
        fac[i]= fac[i-1] * i;
    }
}
void pre_second() {
    for(int i=0;i<8;i++){
        for(int j = prime[i]; n-1 >=j  ; j= j*prime[i])
            factor[i] += (n-1)/j;
    }
}

ll  C(ll m,ll  k){
    ll ret=1;
    ll tfac = fac[k];

    int tfn=0;
    int tfactor[8];
    int tprime[8];
    for(int i=0;i<8;i++) {
        if( factor[i])
            tfactor[tfn++] = factor[i];
        tprime[i] = prime[i];
    }

    for(ll i=m ;i >= m - (k-1)   ;i--) {
        ll  t = i;
        for( int j=0;j<tfn;j++){
            while( t % tprime[j] == 0) {
                tfactor[j] --;
                t /= tprime[j];
                if(tfactor[j]== 0 ) {
                    if( j ==tfn-1 ) tfn-- ;
                    else {
                        swap(tprime[j],tprime[tfn-1]);
                        swap(tfactor[j],tfactor[tfn-1]) ;
                        tfn--;
                        j--;
                    }
                    break;
                }
            }
        }
        // if(tfac!=1) {
        //     ll d = GCD(t,tfac);
        //     t/=d ;
        //     tfac/=d;
        // }
        ret = (ret * (t%P) ) % P;
    }
    return ret;
}
int main(){
    cin >> n >>s ;
    for(int i=0;i<n;i++) cin >> f[i];
    factorize();
    ll ans =0 ;

    pre_second();
    for(int i=0;i< (1<<n) ;i++){
        int count =0 ;
        for(int j = i; j ; j >>=1 ) if ( j&1)  count ++ ;
        ll  sgn =1 ;
        if( count &1 ) sgn =-1 ;
        ll a = s+n-1;
        ll b = n-1;
        for(int j = i,pos=0; j ; j>>=1,pos++  ) if(j &1) a-=(f[pos]+1);
        if( a >= b  )  ans = (ans + sgn*C(a,b)+P )%P;
    }
    cout << ans <<endl;
    return 0;
}

#include <bits\stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;
typedef long long LL;

LL inv(LL x)/// 求逆元
{
    return x == 1 ? 1LL : (MOD - MOD / x) * inv (MOD % x) % MOD;
}
LL Cmn(LL n, LL m) ///求组合数
{
    LL ret = 1;
    for (int i = 1; i <= m; i++)
        ret = (n - i + 1) % MOD * ret % MOD * inv(i) % MOD;
    return ret;
}

int n;
LL s, a[25];
int main()
{
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int ALL = (1 << n) - 1;
    LL ans = 0;
    for (int i = 0; i <= ALL; i++)///遍历所有集合
    {
        LL nows = s;
        int num = 0;///统计当前集合元素个数，以确定符号
        for (int j = 0; j < n; j++)
        {
            if (i & (1 << j))
            {
                nows -= a[j] + 1;
                num++;
            }
        }
        if (nows < 0) continue;
        if (num & 1)///集合含有奇数个元素，符号为-
            ans -= Cmn(nows + n - 1, n - 1);
        else///集合含有偶数个元素，符号为+
            ans += Cmn(nows + n - 1, n - 1);
        ans %= MOD;
    }
    cout << (ans + MOD) % MOD << endl;
    return 0;
}

#include <iostream>
#include <vector>
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define I64 long long
#define I32 int
#define MOD 1000000007
using namespace std;
I64 N,S;
I64 arr[20],ans=0,inv[1000];
I64 comb(I64 a,I64 b){
	if(a<0||b>a)
		return 0;
	if(a<=1)
		return 1;
	b=max(a-b,b);
	I64 ans=1;
	for(I64 i=b+1,j=1;i<=a;i++,j++){
		ans=((ans*(i%MOD))%MOD*inv[j])%MOD;
	}
	return ans;
}
I64 findInverse(I64 a,I64 b){
	I64 x[3];
	I64 y[3];
	I64 quotient  = a / b;
	I64 remainder = a % b;
	x[0] = 0;
	y[0] = 1;
	x[1] = 1;
	y[1] = quotient * -1;
	I64 i = 2;
	for (; (b % (a%b)) != 0; i++){
		a = b;
		b = remainder;
		quotient = a / b;
		remainder = a % b;
		x[i % 3] = (quotient * -1 * x[(i - 1) % 3]) + x[(i - 2) % 3];
		y[i % 3] = (quotient * -1 * y[(i - 1) % 3]) + y[(i - 2) % 3];
	}
	//x[i — 1 % 3] is inverse of a
	//y[i — 1 % 3] is inverse of b
	return x[(i - 1) % 3];
}
int main(){
	for(int i=1;i<1000;i++)
		inv[i]=(findInverse(i,MOD)+MOD)%MOD;
	/*for(int i=1;i<21;i++)
		cout << i << " " << inv[i] << endl;*/
	cin >> N >> S;
	for(int i=0;i<N;i++)
		cin >> arr[i];
	for(int i=0,cnt;i<1<<N;i++){
		cnt=0;
		I64 sum=0;
		for(int j=0;j<N;j++)
			if((1<<j)&i)
				cnt++,sum+=arr[j]+1;
		ans+=(cnt%2==0?1:-1)*comb(N+S-1-sum,N-1);
		ans%=MOD;
	}
	ans=(ans+MOD)%MOD;
	cout << ans << endl;//316418090
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int INF = 0x3f3f3f3f;
LL mod = 1e9 + 7;
const int N = 100005;

LL a[30];
LL NY(LL a, LL m) { return a == 1 ? 1 : NY(m % a, m) * (m - m / a) % m; }
LL com(LL n, LL m) {
    if (n < m) return 0;
    LL res = 1;
    for (LL i = n; i >= n - m + 1; i--) {
        res = i % mod * res % mod;
    }
    for (LL i = 1; i <= m; i++) {
        res = res * NY(i, mod) % mod;
    }
    return res;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("in", "r", stdin);
#endif
    LL n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    map<LL, LL> mp;
    mp[0] = 1;
    for (int i = 0; i < n; i++) {
        map<LL, LL> tmp = mp;
        for (auto x : mp) {
            tmp[x.first + a[i] + 1] += -x.second;
        }
        swap(mp, tmp);
    }
    LL ans = 0;
    // for (auto x : mp) {
    //     printf("%lld %lld\n", x.first, x.second);
    // }
    for (auto x : mp) {
        //if (x.first > m) break;
        ans += com(n + m - x.first - 1, n - 1) * x.second;
        ans %= mod;
    }
    if (ans < 0) ans += mod;
    cout << ans << endl;
    return 0;
}

/*Divyam Goyal - IIT-BHU*/
#include<bits/stdc++.h>
using namespace std;

//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define bitcount    __builtin_popcountll
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define ll long long
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define pb(x) push_back(x)
#define MOD 1000000007
#define MAX 100005

long long int powmod( long long int base, long long int exponent)

{
    if (exponent == 0) return 1;  // base case;
    long long int temp = powmod(base, exponent/2);
    temp=temp%MOD;
    if (exponent % 2 == 0)
        return (temp * temp)%MOD;
    else
        return ((base%MOD) * ((temp * temp)%MOD))%MOD;
}

int fact[25];
int inv[25];
ll f[25];

int ncr(ll n,int r)
{
/*    if(r==0)
        return 1;
    if(n<=0||r==0)
        return 0;
*/
    if(r>n)
        return 0;
    ll ans=1;
    for(ll i=n;i>n-r;i--)
    {

        ans=(1ll*(ans%MOD)*(i%MOD))%MOD;
    }

    return (1ll*ans*inv[r])%MOD;

}

int main()
{
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<23;i++){
        fact[i]=(1ll*fact[i-1]*i)%MOD;
        inv[i]=powmod(fact[i],MOD-2);
    }

    int n;
    ll s;
    cin>>n>>s;
    for(int i=0;i<n;i++)
        cin>>f[i];

    int t=(1<<n);
    int ans=0;
    for(int bit=0;bit<t;bit++)
    {
        ll temp=0;
        for(int i=0;i<n;i++)
        {
            if(bit&(1<<i))
            {
                temp+=f[i]+1;
            }
        }
        //trace2(temp,bit);
        //trace2(bit,ncr(n+s-temp-1,n-1));
        if(bitcount(bit)%2==1)
        {
            ans=(ans-ncr(n+s-temp-1,n-1)+MOD)%MOD;
        }
        else
            ans=(ans+ncr(n+s-temp-1,n-1))%MOD;
        //trace1(ans);
    }

    cout<<ans;

    return 0;

}

#include <iostream>
#include <cstdio>
#include <cstring>
#define int long long
using namespace std;

inline int read(){
	int sum=0,f=1;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return f*sum;
}

const int Mod=1e9+7;
int n,m,inv[21],a[21];

inline int fpow(int a,int b,int p){
	int ret=1;
	while(b){
		if(b&1) ret=ret*a%p;
		a=a*a%p;b>>=1;
	}
	return ret;
}

inline int C(int n,int m){
	if(n<0||m<0||m>n) return 0;
	n%=Mod;
	if(!m||!n) return 1;
	int ans=1;
	for(int i=0;i<m;i++) ans=ans*(n-i)%Mod;
	for(int i=1;i<=m;i++) ans=ans*inv[i]%Mod;
	return ans;
}

signed main(){
	n=read();m=read();int ans=0;
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=20;i++) inv[i]=fpow(i,Mod-2,Mod);
	for(int x=0;x<1<<n;x++){
		if(!x) ans=(ans+C(n+m-1,n-1))%Mod;
		else{
			int t=m+n,p=0;
			for(int i=0;i<n;i++){
				if(!(x>>i&1)) continue;
				p++;t-=a[i+1];
			}
			t-=p+1;
			if(p&1) ans=(ans-C(t,n-1))%Mod;
			else ans=(ans+C(t,n-1))%Mod;
		}
	}
	printf("%lld\n",(ans+Mod)%Mod);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
long long a[22],inv[22],n,m,ans;
inline long long power(long long a,int b){
	long long res = 1 ;
	for( ; b ; b >>= 1){
		if(b&1) res = res*a%mod;
		a = a*a%mod;
	}
	return res;
}
inline long long C(long long y,long long x){
	if(y < 0 || x < 0 || y < x) return 0ll;
	y = y%mod;
	if(y == 0 || x == 0) return 1;
	long long res = 1 ;
	for(int i = 0 ; i < x ; i++) res = res*(y-i)%mod;
	for(int i = 1 ; i <= x ; i++) res = res*inv[i]%mod;
	return res;
}
int main(){
//	freopen("in.txt","r",stdin);
	for(int i = 1 ; i <= 20 ; i++) inv[i] = power(i,mod-2);
	cin >> n >> m ;
	for(int i = 1 ; i <= n ; i++) scanf("%lld",&a[i]);
	for(int x = 0 ; x <(1<<n) ; x++){
		if(x == 0) ans = (ans+C(n+m-1,n-1))%mod;
		else{
			long long t = n+m ; int p = 0;
			for(int i = 0 ; i < n ; i++)
		        if(x >> i & 1) p++,t -= a[i+1];
		    t -= p+1;
		    if(p&1) ans = (ans-C(t,n-1))%mod;
		    else ans = (ans+C(t,n-1))%mod;
		}
	}
	cout << (ans+mod)%mod << endl;
	return 0;
}

#include <iostream>

const int N = 20;
const long long MOD = (long long) (1e9 + 7);

int n;
long long s, f[N], ans, inv[N];

long long pow(long long a, long long b) {
    long long ans = 1ll;
    for (a %= MOD; b; b /= 2, a = (a * a) % MOD) {
        if (b & 1) {
            ans = (ans * a) % MOD;
        }
    }
    return ans;
}

long long comb(long long n, long long m) {
    if (n < m) {
        return 0ll;
    }
    long long ans = 1;
    for (int i = 0; i < m; ++i) {
        ans = (ans * ((n - i + MOD) % MOD)) % MOD;
        ans = (ans * inv[i + 1]) % MOD;
    }
    return ans;
}

int main() {
    for (int i = 1; i < N; ++i) {
        inv[i] = pow(i, MOD - 2);
    }
    while (std::cin >> n >> s) {
        for (int i = 0; i < n; ++i) {
            std::cin >> f[i];
        }
        ans = 0;
        for (int i = 0; i < (1 << n); ++i) {
            int cnt = 0;
            long long x = s;
            for (int j = 0; j < n; ++j) {
                if ((i >> j) & 1) {
                    cnt++;
                    x -= (f[j] + 1);
                }
            }
            if (cnt & 1) {
                ans = (ans - comb(n + x - 1, n - 1) + MOD) % MOD;
            } else {
                ans = (ans + comb(n + x - 1, n - 1)) % MOD;
            }
        }
        std::cout << ans << std::endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
//            1000000007
long long n,s,f[66];

long long OoO(long long x,long long y) //快速幂；
{
	long long ans=1;
	while(y)
	{
		if(y&1) ans=(ans*x)%mod;
		x=(x*x)%mod;
		y>>=1;
	}
	return ans;
}

long long work(long long a,long long b)
{
	 if(a<b) return 0;
     if(b>a-b) b=a-b;
	 long long s1=1,s2=1;
	 for(long long i=0;i<b;i++)
	 {
		 s1=s1*(a-i)%mod;
		 s2=s2*(i+1)%mod;
	 }
	 return s1*OoO(s2,mod-2)%mod;
}

long long special(long long x,long long y)    //特殊情况和乘法处理，赖的打；
{
	if(y==0) return 1;
	return work(x%mod,y%mod)*special(x/mod,y/mod)%mod;
}

long long QAQ()
{
	long long ans=0;
	for(int i=0;i<(1<<n);i++)  //二进制法；
	{
		long long s2=1,sum=s;
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
			sum-=f[j]+1;
            s2*=-1;
			}
		}

		if(sum<0) continue;  //不合法！
		ans+=s2*special(sum+n-1,n-1);
		ans%=mod;
	}

	return (ans+mod)%mod;
}

void init()
{
	scanf("%lld%lld",&n,&s);
	for(int i=0;i<n;i++) scanf("%lld",&f[i]);
}

int main()
{
	init();
	printf("%lld\n",QAQ());
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
long long a[22],m,ans=0;
int inv[22],n;

// a^b
int q_pow(int a,int b){
	int c=1;
	for(;b;b>>=1){
		if(b&1)
			c=(long long)c*a%mod;
		a=(long long)a*a%mod;
	}
	return c;
}

// C(y,x)
int C(long long y,int x){
	if(y<0||x<0||y<x)
		return 0;
	y%=mod;
	if(y==0||x==0)
		return 1;
	int ans=1;
	for(int i=0;i<x;++i)
		ans=(long long)ans*(y-i)%mod;
	for(int i=1;i<=x;++i)
		ans=(long long)ans*inv[i]%mod;
	return ans;
}

int main(){
	for(int i=1;i<=20;++i)
		inv[i]=q_pow(i,mod-2);
	cin>>n>>m;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	for(int x=0;x<1<<n;++x){
		if(x==0){
			ans=(ans+C(n+m-1,n-1))%mod;
		}
		else{
			long long t=n+m;
			int p=0;
			for(int i=0;i<n;++i)
				if(x>>i&1){
					p++;
					t-=a[i+1];
				}
			t-=p+1;
			if(p&1)
				ans=(ans-C(t,n-1))%mod;
			else
				ans=(ans+C(t,n-1))%mod;
		}
	}
	cout<<(ans+mod)%mod;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
#define mp make_pair
#define pb push_back

const int mod = 1e9+7;

const int N = 21;

ll fast_pow(ll a, ll b){
    a %= mod;
    ll ans = 1;
    while(b > 0){
        if(b&1) ans = (ans*a) % mod;
        a = (a * a) % mod;
        b /= 2;
    }
    return ans;
}

ll nCr(ll n, ll r){
    n %= mod;
    ll num = 1, den = 1;
    for(int j = 1; j <= r; j++)
        num = (num * (n - j + 1 + mod) % mod) % mod, den = (den * j) % mod;
    return (num * fast_pow(den, mod-2)) % mod;
}

ll a[N], n, s;

ll solve(){
    ll r_ans = 0;
    for(int j = 1; j < (1 << n); j++){
        int cnt = 0;
        ll mini = 0;
        for(int k = 0; k < n; k++)
            if(j & (1 << k)) cnt++, mini += a[k]+1;
        if(s < mini) continue;

        ll lft = s - mini;
        if(cnt % 2) r_ans = (r_ans + nCr(lft+n-1, n-1)) % mod;
        else r_ans = (r_ans - nCr(lft+n-1, n-1) + mod) % mod;
    }
    ll ans = (nCr(s+n-1, n-1) - r_ans + mod) % mod;
    return ans;
}

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

    //cout << nCr(100000000000000, 3) << endl;
    cin >> n >> s;
    for(int j = 0; j < n; j++) cin >> a[j];
    cout << solve() << endl;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<math.h>
#include<cstring>

using namespace std;

typedef long long LL;

const int MAXN=25;
const int MOD=1e9+7;

int N;
LL S;
LL f[MAXN];

LL pow(LL a,LL b){
	LL res=1;
	while(b){
		if(b&1){
			res=res*a%MOD;
		}
		b>>=1;
		a=a*a%MOD;
	}
	return res;
}

LL C(LL n,LL m){
	if(n<m) return 0LL;
	m=min(m,n-m);
	LL tmp_1=1LL;
	LL tmp_2=1LL;
	for(LL i=1;i<=m;i++){
		tmp_1=tmp_1*(n-i+1)%MOD;
		tmp_2=tmp_2*i%MOD;
	}
	return tmp_1*pow(tmp_2,MOD-2)%MOD;
}

LL Lucas(LL n,LL m){
	if(n<MOD&&m<MOD) return C(n,m);
	return C(n%MOD,m%MOD)%MOD*Lucas(n/MOD,m/MOD)%MOD;
}

int main(){
	while(~scanf("%d%lld",&N,&S)){
		for(int i=1;i<=N;i++) scanf("%lld",&f[i]);
		LL ans=0;
		for(LL i=0;i<(1LL<<N);i++){
			LL flag=1;
			LL cnt=S;
			for(int j=0;j<N;j++){
				if((1LL<<j)&i){
					cnt-=f[j+1]+1LL;
					flag=-flag;
				}
			}
			if(cnt<0) continue;
			ans=(ans+flag*Lucas(cnt+N-1,N-1)%MOD)%MOD;
		}
		printf("%lld\n",(ans+MOD)%MOD);
	}

	return 0;
}

#include <sstream>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <list>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <bits/stdc++.h>
using namespace std;

#define SZ(x) ((int)x.size())
#define mem(name,val) memset(name,(val),sizeof(name));
#define ll long long
#define SF scanf
#define PF printf
#define psb(b) push_back((b))
#define ppb() pop_back()
#define oo (1<<28)
#define mp make_pair
#define fs first
#define sc second
#define Read freopen("in.txt","r",stdin)
#define Write freopen("out.txt","w",stdout)
#define __ std::ios_base::sync_with_stdio (false)

///V^2*E Complexity
///number of augment path * (V+E)
///Base doesn't matter
int mod=1000000007;
int inv[30];
ll fd[30];
//__builtin_popcount
int check(int mask,int pos)
{
    return (bool)(mask&(1<<pos));
}
ll bigmod(int n,int p,int mod)
{
    if(p==1)return n;
    if(p&1)
    {
        return (n*bigmod(n,p-1,mod))%mod;
    }
    ll f=bigmod(n,p/2,mod);
    return (f*f)%mod;
}
ll func(ll n,ll r)
{
    ll v=(n-r)%mod;
    ll ret=1;
    if(r>20)while(1);
    for(ll i=v+1,j=1;j<=r;i++,j++)
    {
        if(i>=mod)i%=mod;
        ret*=i;
        if(ret>=mod)ret%=mod;
        ret*=inv[j];
         if(ret>=mod)ret%=mod;
    }
    return ret;
}

int main()
{
    for(int i=1;i<=21;i++)
    {
        inv[i]=bigmod(i,mod-2,mod);
    }
    int n;
    ll S;
    scanf("%d%lld",&n,&S);
    for(int i=0;i<n;i++)scanf("%lld",&fd[i]);
    ll ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        ll ds=S;
        for(int j=0;j<n;j++)
        {
            if(!check(i,j))continue;
            ds-=(fd[j]+1);
        }
        // cout<<ds<<" "<<i<<" "<<endl;
        if(ds<0)continue;
       // cout<<i<<endl;
        ll gt=func(ds+n-1,n-1);
     //   cout<<i<<endl;
        if(__builtin_popcount(i)&1){
            ans-=gt;
            if(ans<0)ans=(ans+mod)%mod;
        }
        else ans+=gt;
    }
    cout<<(ans)%mod<<endl;

}

#include<cstdio>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=22;
int inv[22];
ll a[22];
ll re()
{
	ll x=0;
	char c=getchar();
	bool p=0;
	for(;c<'0'||c>'9';c=getchar())
		p=(c=='-'||p)?1:0;
	for(;c>='0'&&c<='9';c=getchar())
		x=x*10+(c-'0');
	return p?-x:x;
}
int C(ll y,int x)
{
	int i,s=1;
	if(y<0||x<0||y<x)
		return 0;
	y%=mod;
	if(!y||!x)
		return 1;
	for(i=0;i<x;i++)
		s=1LL*(y-i)*s%mod;
	for(i=1;i<=x;i++)
		s=1LL*inv[i]*s%mod;
	return s;
}
int main()
{
	int i,n,x,o,y;
	ll k,s=0,m;
	inv[1]=1;
	for(i=2;i<=20;i++)
		inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;
	n=re();
	m=re();
	for(i=1;i<=n;i++)
		a[i]=re();
	for(x=0,o=1<<n;x<o;x++)
	{
		if(!x)
			s=(s+C(n+m-1,n-1))%mod;
		else
		{
			k=n+m;
			y=0;
			for(i=0;i<n;i++)
				if((x>>i)&1)
				{
					y++;
					k-=a[i+1];
				}
			k-=y+1;
			if(y&1)
				(s-=C(k,n-1))%=mod;
			else
				(s+=C(k,n-1))%=mod;
		}
	}
	printf("%I64d",(s+mod)%mod);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
ll a[22],m,ans;
ll inv[22],n;
ll qpow(ll a,ll b)
{
	ll ans=1;
	while (b)
	{
		if (b&1) ans=1LL*ans*a%mod;
		b>>=1;
		a=1LL*a*a%mod;
	}
	return ans;
}
ll C(ll y,ll x)
{
	if (y<0||x<0||y<x) return 0;
	y%=mod;
	if (y==0||x==0) return 1;
	ll ans=1;
	for (ll i=0;i<x;i++)
		ans=1LL*ans*(y-i)%mod;
	for (ll i=1;i<=x;i++)
		ans=1LL*ans*inv[i]%mod;
	return ans;
}
int main()
{
	for (ll i=1;i<=20;i++) inv[i]=qpow(i,mod-2);
	scanf("%lld%lld",&n,&m);
	for (ll i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (ll x=0;x<(1<<n);x++)
	{
		if (x==0) ans=(ans+C(n+m-1,n-1))%mod;
		else
		{
			long long t=n+m;
			ll p=0;
			for (ll i=0;i<n;i++)
				if (x>>i&1)
				{
					p++;
					t-=a[i+1];
				 }
			t-=p+1;
			if (p&1) ans=(ans-C(t,n-1))%mod;
			else ans=(ans+C(t,n-1))%mod;
		}
	}
	printf("%lld\n",(ans+mod)%mod);
	return 0;
}

#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long lt;
lt read()
{
    lt f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

const lt mod=1e9+7;
const int maxn=50;
lt a[maxn],inv[maxn];
lt ans;

lt C(lt n,lt m)
{
    if(n<0||m<0||n<m)return 0;
    if(n%mod==0||m==0)return 1;
    lt res=1;
    for(lt i=n-m+1;i<=n;++i)
    res*=(i%mod),res%=mod;
    for(int i=1;i<=m;++i)
    res*=inv[i],res%=mod;
    return res;
}

lt qpow(lt b,lt k)
{
    lt res=1;
    while(k>0)
    {
        if(k&1)res=(res*b)%mod;
        b=(b*b)%mod;
        k>>=1;
    }
    return res;
}

int main()
{
    lt n=read(),m=read();
    for(int i=1;i<=n;++i)a[i]=read();
    for(int i=1;i<=20;++i)inv[i]=qpow(i,mod-2);

    ans=C(n+m-1,n-1)%mod;
    for(int i=1;i<=(1<<n)-1;++i)
    {
        lt k=n+m,p=0;
        for(int j=0;j<n;++j)
        if((1<<j)&i)p++,k-=a[j+1];
        k-=p+1;
        if(p&1) ans-=C(k,n-1),ans%=mod;
        else ans+=C(k,n-1),ans%=mod;
    }
    printf("%lld",(ans+mod)%mod);
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define mod 1000000007
typedef long long ll;
ll a[22];
ll s;
int n;

ll pow_ni(ll n,ll x)
{
    ll ans=1;
    ll temp=x;
    int j=0;

    while(n)
    {
        if((1<<j)&n)
        {
            ans=ans*temp%mod;
            n-=1<<j;
        }
        j++;
        temp=temp*temp%mod;
    }
    return ans;
}

ll jisuan(ll n,int k)
{
    if(n<k)return 0;
    ll x=1,y=1;
    ll i;
    for(i=n;i>=n-k+1;i--)x=(x*(i%mod))%mod;
    for(i=k;i>=1;i--)y=y*i%mod;
    return x*pow_ni(mod-2,y)%mod;
}

int main()
{
    while(cin>>n>>s)
    {
        int i,j;
        int ss;
        ll sum=0;
        for(i=0;i<n;i++){
                cin>>a[i];
        sum+=a[i];
        }
        if(s==0)cout<<1<<endl;
        else if(sum<s)cout<<0<<endl;
        else {
        ll ans=0;

        for(ss=0;ss<(1<<n);ss++)
        {
            sum=0;
            int ok=0;
            for(j=0;j<n;j++)if((1<<j)&ss){
                    sum+=a[j]+1;
                    ok++;
            }
            if(sum<s+n-1){
                if(ok%2==0)ans=(ans+jisuan(s+n-1-sum,n-1))%mod;
                else ans=(ans+mod-jisuan(s+n-1-sum,n-1))%mod;
            }

        }
        cout<<ans<<endl;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long

const int P=1e9+7;

int n,s,f[30],inv[30],ans,res;

int power(int a,int b){
	int sum=1;
	while(b){
		if(b&1)
			sum=sum*a%P;
		a=a*a%P;
		b>>=1;
	}
	return sum;
}

int C(int y,int x){
	if(y<0||x<0||y<x)
		return 0;
	y%=P;
	if(y==0||x==0)
		return 1;
	int sum=1;
	for(int i=0;i<x;i++)
		sum=sum*(y-i)%P;
	for(int i=1;i<=x;i++)
		sum=sum*inv[i]%P;
	return sum;
}

signed main(){
	cin>>n>>s;
	for(int i=1;i<=n;i++)
		cin>>f[i];
	for(int i=1;i<=20;i++)
		inv[i]=power(i,P-2);
	res=C(n+s-1,n-1);
	for(int i=1;i<(1<<n);i++){
		int t=n+s-1,cnt=0;
		for(int j=1;j<=n;j++)
			if((i>>(j-1))&1){
				t-=f[j]+1;
				cnt++;
			}
		if(cnt&1)
			ans=(ans+C(t,n-1))%P;
		else ans=(ans-C(t,n-1))%P;
	}
	cout<<(res-ans+P)%P;
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll  a[22],m,ans=0,inv[22];
int n;
ll power_mod(ll a,ll b,ll c)
{
	ll ans=1%c;a%=c;
	while(b)
	{
		if(b&1)ans=ans*a%c;
		a=a*a%mod;b=b>>1;
	}
	return ans;
}
ll C(ll y,int x)
{
	if(y<0||x<0||y<x)return 0;
	y%=mod;
	if((!y)||(!x))return 1;
	ll c=1;
	for(int i=0;i<x;i++)
		c=c*(y-i)%mod;
	c=c*inv[x]%mod;
	return c;
}
int main()
{
	inv[1]=1;
	for(int i=2;i<=20;i++)inv[i]=inv[i-1]*i%mod;
	for(int i=2;i<=20;i++)inv[i]=power_mod(inv[i],mod-2,mod);
	scanf("%d%lld",&n,&m);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);

	for(int x=0;x<	1<<n;x++)
	{
		ll t=n+m;
		int p=0;
		for(int i=0;i<n;i++)if(x>>i&1)
		{
			++p;
			t-=a[i+1];
		}
		t-=p+1;
		if(p&1)ans=(ans-C(t,n-1))%mod;
		else ans=(ans+C(t,n-1))%mod;
	}
	printf("%lld\n",(ans%mod+mod)%mod);
	return 0;
}

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<cstdlib>
#include<cstring>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll size=1e2+10;
ll n,m,s,a[size],inv[size];
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return x*f;
}
ll c(ll y,ll x){
    if(y<x||y<0||x<0) return 0;
    y%=mod;
    if(y==0||x==0) return 1;
    ll ans=1;
    for(ll i=0;i<x;i++) ans=ans*(y-i)%mod;
    for(ll i=1;i<=x;i++) ans=ans*inv[i]%mod;
    return ans;
}
ll power(ll x,ll y){
    ll ans=1;
    for(;y;y>>=1){
        if(y&1) ans=ans*x%mod;
        x=x*x%mod;
    }
    return ans;
}
int main(){
    n=read();m=read();s=(1<<n)-1;
    for(ll i=1;i<=n;i++) a[i]=read();
    for(ll i=1;i<=20;i++) inv[i]=power(i,mod-2);
    ll ans=0;
    for(ll x=0;x<=s;x++){
        ll t=n+m,p=0;
        if(x==0) ans=(ans+c(n+m-1,n-1))%mod;
        else{
            for(ll i=0;i<n;i++){
                if(x>>i&1){
                    p++;t-=a[i+1];
                }
            }
            t-=p+1;
            if(p&1) ans=(ans-c(t,n-1)+mod)%mod;
            else ans=(ans+c(t,n-1))%mod;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
#define f first
#define s second
#define Mp make_pair
#define pb push_back
#define sz(x) x.size()
#define ppb pop_back
#define Lb lower_bound
#define Ub upper_bound
#define all(x) x.begin(), x.end()
#define fast_io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const ll Maxn = 20+5, N = 1e4+5, Mod = 1e9+7, Inf = 1e18;
int n;
ll f[Maxn], ans, s, Ejeiie_Bitch = 1;
ll Power(ll x, ll t){
    if (t == 0) return 1;
    return ((Power((x*x)%Mod, t/2ll)%Mod)*(t%2 ? x : 1ll))%Mod;
}
ll Choose(ll k, ll m){
    ll Ejeiie_Gav = 1;
    for (ll i = k+1ll; i <= m; i++){
        Ejeiie_Gav *= i;
        Ejeiie_Gav %= Mod;
    }
    return (Ejeiie_Gav*Ejeiie_Bitch);
}
int main(){
    fast_io
    cin >> n >> s;
    for (int i = 0; i < n; i++){
        cin >> f[i];
    }
    for (ll i = 1ll; i < n; i++){
        Ejeiie_Bitch *= i;
        Ejeiie_Bitch %= Mod;
    }
    Ejeiie_Bitch = Power(Ejeiie_Bitch, Mod-2);
    for (int msk = 0; msk < (1 << n); msk++){
        ll sp = s;
        for (int i = 0; i < n; i++){
            if ((msk >> i)&1){
                sp -= (f[i]+1ll);
            }
        }
        if (0 <= sp){
            bool cur = (__builtin_popcount(msk)&1);
            ans += (cur ? -1ll : 1ll)*Choose(sp, sp+n-1ll);
            ans %= Mod;
        }
    }
    cout << ans << '\n';
    return 0;
}

#include <iostream>
#include <cstdio>
#define il inline
#define ri register
#define ll long long
#define yyb 1000000007
using namespace std;
ll f[22],jv,n;
il ll pow(ll,ll),take(ll);
int main(){
    ll s,ans(0);int i,j,li;
    scanf("%lld%lld",&n,&s),li=(1<<n)-1;
    for(i=0;i<n;++i)scanf("%lld",&f[i]);
    for(i=jv=1;i<n;++i)(jv*=i)%yyb;jv=pow(jv,yyb-2);
    for(i=0;i<=li;++i){
        ll tot(n-1+s),p(0);
        for(j=0;j<n;++j)
            if(i>>j&1)tot-=f[j]+1,++p;
        if(p&1)(ans-=take(tot))%=yyb;
        else (ans+=take(tot))%=yyb;
    }printf("%lld",(ans+yyb)%yyb);
    return 0;
}
il ll take(ll x){
    if(x<=0||x<n-1)return 0;
    x%=yyb;if(!x)return 1;ll i,ans(1);
    for(i=x-n+2;i<=x;++i)(ans*=i)%=yyb;
    return ans*jv%yyb;
}
il ll pow(ll x,ll y){
    ll ans(1);while(y){
        if(y&1)(ans*=x)%=yyb;
        (x*=x)%=yyb,y>>=1;
    }return ans;
}

#include <iostream>

using namespace std;

const int mod = 1000000007;

int mulMod(int num, int m)
{
	return (int)((((long long)num) * m) % mod);
}

int invertMod(int num)
{
	// the mod is prime
	// return (num)^(p-1) mod p

	int exp = mod - 1;
	int output = 1;
	int mul = num;

	while(exp > 0)
	{
		if(exp % 2 == 1)
		{
			output = mulMod(output, mul);
		}

		mul = mulMod(mul, mul);

		exp /= 2;
	}

	return output;
}

/*
 * Mod: 10^9 + 7
 * */
int d(long long s, int n)
{
	int output = 1;

	// returns: binom(n+s-1, n-1) mod 1 000 000 007
	// assumes: n << mod (true because it's given n < 20, mod > 20)

	if((n+s-1) - (n-1) > mod)
		return 0;

	for(int k=n; k<=(n+s-1); k++)
	{
		output = mulMod(output,k);
	}

	int invInverse = 1;

	for(int k=2; k<n; k++)
	{
		invInverse = mulMod(invInverse, k);
	}

	return mulMod(invertMod(invInverse), output);
}

int main()
{
	int n;
	long long s;

	cin >> n;
	cin >> s;

	long long* f = new long long[n];
	for(int i=0; i<n; i++)
		cin >> f[i];

	long long sum = -s;

	for(int i=0; i<n; i++)
	{
		sum += f[i];
	}

	cout << d(sum,n) << endl;

	return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define DEBUG_ON 1

#define INF 0x3f3f3f3f
#define NSYNC ios::sync_with_stdio(false)
#define FOR(i,a,b) for(int i=a; i<(b); ++i)
#define FOR0(i,b) for(int i=0; i<(b); ++i)
#define TRAV(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define RTRAV(it,c) for(__typeof((c).rbegin()) it=(c).rbegin(); it!=(c).rend(); ++it)
#define DBG(x) if(DEBUG_ON) cout << #x << " == " << x << endl
#define DBGP(x, y) if(DEBUG_ON) cout << "(" << x << ", " << y << ")" << endl
#define DBGV(v) if(DEBUG_ON) for (auto x : (v)) cout << x << " "; cout << endl
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define sz(a) (int)((a).size())
#define all(c) (c).begin(),(c).end()
#define R(x) scanf(" %d",&(x))
#define RR(x,y) scanf(" %d %d",&(x), &(y))
#define CLR(v) memset(v, 0, sizeof(v))
#define SET(v) memset(v, -1, sizeof(v))

typedef long long ll;
typedef int int_type;
typedef pair<int_type, int_type> pii;
typedef vector<int_type> vi;

const int MOD = 1000000007;

ll inv[110];

ll fastpow(ll a, ll b) {
	if (!b) return 1;
	ll aux = fastpow(a,b/2);
	aux = (aux*aux)%MOD;
	if (b&1) aux = (aux*a)%MOD;
	return aux;
}

void precalc() {
	ll fact = 1;
	inv[0] = fastpow(1,MOD-2);
	FOR(i,1,100) {
		fact = (fact*i)%MOD;
		inv[i] = fastpow(fact, MOD-2);
	}
}

//~ ll nCk(ll n, ll k) {
	//~ if (n < k) return 0;
	//~ k = min(k, n-k);
	//~ ll num = 1;
	//~ for(ll i = n-k+1; i <= n; ++i) num = (num*i)%MOD;
	//~ num = (num*inv[k])%MOD;
	//~ return num;
//~ }

long long nCk(long long a, long long b)
{
	if(a < 0 || b < 0 || a < b) return 0;
	long long ret = 1;
	for(long long i = a; i >= a-b+1; i--)
		ret = (ret * (i % MOD)) % MOD;
	for(int i = 1; i <= b; i++)
		ret = (ret * inv[i]) % MOD;
	return ret;
}

ll v[25];
ll n,s;

int main() {
	precalc();
	cin >> n >> s;
	FOR0(i,n) cin >> v[i];
	ll sum = 0, num = n+s-1, den = n-1;
	FOR(mask, 1, (1<<n)) {
		int qtd = 0;
		ll rem = 0;
		for (int idx = 0, j = mask; j; ++idx, j >>= 1) if (j&1) {
		//~ for (int i=0; i < n; ++i) if (j&(1<<i)) {
			++qtd;
			rem += v[idx]+1;
		}
		int sign = (qtd&1 ? 1 : -1);
		//~ cout << sign*nCk(num-rem,den) << endl;
		//~ DBG(num-rem);

		if (num>rem) {

			//~ cout << mask << endl;
			//~ cout << num-rem << endl;
			//~ cout << den << endl;
			//~ cout << sign*nCk(num-rem,den) << endl << endl;

			sum = (sum + sign*nCk(num-rem,den))%MOD;
		}
	}

	ll ans = ((nCk(num, den) - sum)%MOD + MOD)%MOD;

	//~ DBG(nCk(1000,19));

	cout << ans << endl;
	//~ FOR0(i,20) cout << "inv[" << i << "] = " << inv[i] << endl;
	return 0;
}

#include<bits/stdc++.h>

#define REP(i,n) for( int (i)=0;(i)<(int)(n); ++(i))
#define REPR(i,n) for( int (i) = n; (i)>=0; --(i))
#define REPN(i,x,y) for( int i = x; (i) < (int)(y); (i)++ )
#define REPIT(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define ZERO(x) memset(x,0,sizeof(x))
#define NEG(x) memset(x,-1,sizeof(x))
#define SZ(x) (int)(x).size()
#define RI(n) scanf("%d",&(n))
#define RII(x,y) scanf("%d %d",&(x),&(y))
#define RIII(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define RS(x) scanf("%s",x)
#define OI(x) printf("%d\n",(x))
#define OII(x,y) printf("%d %d\n",(x),(y))
#define OIII(x,y,z) printf("%d %d %d\n",(x),(y),(z))
#define MP(x,y) make_pair((x),(y))
#define FT first
#define SD second
#define PB push_back
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
LL LLMAX = 9223372036854775807LL;
const int MOD = 1000000007;
const int maxn = 100010;
int n;
LL s,f[21];
LL inv[55];
LL POW(LL x,LL b){
    LL ret = 1,y = x;
    while(b>0){
        if(b&1)ret = (ret*y)%MOD;
        y = (y*y)%MOD;
        b>>=1;
    }
    return ret;
}
LL C(LL a,LL b){
    a%=MOD;
    if(a<b)return 0;
    LL ret = 1;
    for(LL i = 0;i < b;++i){
        ret *= (a-i);
        ret%=MOD;
    }
    ret = (ret*inv[b])%MOD;
    return ret;
}
int main()
{
    freopen("in.txt","r",stdin);

    inv[1] = 1;
    for(LL i=2;i<=30;++i){
        inv[i] = (inv[i-1]*POW(i,MOD-2))%MOD;
    }
    //cerr<<C(20,20)<<endl;
    cin>>n>>s;
    REP(i,n)cin>>f[i];
    LL ans = 0;
    for(int i=0;i < (1<<n); ++i){
        LL ts = s;
        int x = 0;
        for(int j=0;j<n;++j)if((1<<j) &i){
            ts -= (f[j]+1);
            x++;
        }
        if(ts<0)continue;
        LL tx = C(n+ts-1,n-1);
        if(x%2==0)ans += tx;
        else ans = ans + MOD -tx;
        ans%=MOD;
    }
    cout<<ans<<endl;
}

#include <bits/stdc++.h>
#define MOD 1000000007

using namespace std;
typedef long long int ll;

int inv[25];

ll modpow(ll base,ll exp){
  ll res=1;
  while(exp){
    if(exp&1) res=(res*base)%MOD;
    base = ( base * base ) % MOD;
    exp >>= 1;
  }
  return res;
}

ll comb(ll n,ll r){
  if( r>n || r<0 || n<0 ) return 0;
  r=min(r,n-r);
  ll res=1;
  for(ll x=1;x<=r;++x){
    res = ( res * ( n - ( x - 1 ) ) ) % MOD;
    res = ( res * inv[ x ] ) % MOD;
    assert( x<25 );
  }

  return res;
}

void solve(ll n, ll s, vector<ll> f){
  for( ll i=1; i<25; ++i ){
    inv[i] = modpow( i, MOD-2 );
  }

  ll maxbit = 1<<n;
  ll res = 0;

  for( ll bit=0; bit<maxbit; ++bit){
    ll cnt,rem,coff;
    cnt=0;
    coff=1;
    for(ll mask=1,i=0;mask<=bit; mask<<=1,++i)
      if(bit&mask) cnt += (f[i]+1), coff=coff*(-1);
    coff = (coff+MOD)%MOD;
    assert(coff>=0);
    rem=s-cnt;
    if( rem <0 ) continue;
    // cout<< bit <<" _-___"<< coff<<" "<<cnt<<" "<<res<<endl;
    res = ( res + (comb( n+rem-1, rem )*coff)%MOD ) % MOD;
  }

  cout<<res<<endl;
}

int main(){
  ll n,s;
  cin>>n>>s;

  vector<ll> f(n);
  for(int i=0;i<n;++i) cin>>f[i];
  solve(n,s,f);

  return 0;
}

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
#define debug(a) cout<<#a<<" --> "<<(a)<<endl;
#define fastInput ios_base::sync_with_stdio(false);cin.tie(0)
#define INPUT freopen("input.txt","r",stdin)
#define OUTPUT freopen("output.txt","w",stdout)
#define Error  1e-9
#define pi (2*acos(0))
const ll mod =1e9+7 ;
const int N = 1e4+5;
map<ll,ll>mp;
ll bigmod(ll a, ll b, ll m)
{
    if(b==0)
        return 1%m;
    ll x=bigmod(a,b/2,m);
    x=(x*x)%m;
    if(b%2==1)
        x=(x*a)%m;
    return x;
}
ll fact[N];
void init()
{
    fact[0]=1;
    for(ll i=1; i<N; i++)
        fact[i]= (fact[i-1]*i)%mod;
}
ll getncr(ll n, ll r)
{
    ll up = 1;
    for(ll i=n;i>=(n-r+1);i--)
    {
        up*=(i%mod);
        up%=mod;
    }
    ll down =fact[r];
    return (up * bigmod(down,mod-2,mod))%mod;
}
void Solve(int cas)
{
    init();
    ll n,s,ans =0 ;
    cin>>n>>s;
    vector<ll>a(n);
    vector<ll>prod(1,1);
    mp[0]=1;
    for(ll &i:a)
    {
        cin>>i;
        if(i==0)
            continue;
        ll eta= i+1;
        map<ll,ll>tmp;
        for(auto it:mp)
        {
            tmp[it.first+eta] += -it.second;
        }
        for(auto it:tmp)
        {
            mp[it.first] += it.second;
        }
    }
    for(auto it:mp)
    {
        if(it.first>s)
            break;
        ll lagbe = s- it.first;
        ans+= it.second* getncr(n+lagbe-1,n-1);
        ans%=mod;
    }
    cout<<ans<<endl;

}

int main()
{
    //INPUT;
    //OUTPUT;
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        Solve(++cas);
    }

    return 0;
}
/*

*/

//os.order_of_key(v): returns how many elements strictly less than v
//os.find_by_order()

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    //os<<"{"<<p.first<<", "<<p.second<<"} ";
    os<<p.first<<" "<<p.second;
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    //os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<endl ;
    }
    //os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}

#include <iostream>
using namespace std;

typedef long long LL;
const int kN = 25, kMod = 1000000007;
LL n, m, a[kN], g[kN] = {1}, ans;  // g: 阶乘

LL Power(LL x, LL y) {  // (x^y) mod kMod
  LL ans = 1;
  for (x %= kMod; y; y >>= 1) {
    if (y & 1) ans = ans * x % kMod;
    x = x * x % kMod;
  }
  return ans % kMod;
}

LL C(const LL &x, LL y) {
  // x! / (y! * (x-y)!) = ∏<x-y+1, y> / y!
  if (x < 0 || y < 0 || x < y) return 0;
  LL ans = 1;
  y %= kMod;

  for (int i = 0; i < y; i++)
    ans = ans * (x - i) % kMod;
  return ans * Power(g[y], kMod - 2) % kMod;
}

int main () {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    cin >> a[i], g[i] = g[i - 1] * i;

  ans = C(n + m - 1, n - 1) % kMod;

  for (int i = 1, sz = 1 << n; i < sz; i++) {
    LL t = n + m, cnt = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) cnt++, t -= a[j + 1];
    t -= cnt + 1;

    if (cnt & 1)
      ans = (ans - C(t, n - 1)) % kMod;
    else
      ans = (ans + C(t, n - 1)) % kMod;
  }

  cout << (ans % kMod + kMod) % kMod;
  cout << flush;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
ll ans = 0;
ll mod = 1000000007;
ll poww(ll a, ll b){
    ll res = 1;
    while (b > 0){
        if(b & 1) res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res;
}
map<int,int> poly;
int n , s , f[21];
int fat[22] , ifat[22];

int ncr(int x , int y){
	if(y > x || x < 0 || y < 0) return 0;
	int ans = 1;
	while(x > y){
		ans *= x;
		ans %= mod;
		x--;
	}
	ans *= ifat[n-1];
	ans %= mod;
	return ans;
}

int32_t main(){
	scanf("%lld%lld" , &n , &s);
	fat[0] = 1 , ifat[0] = fat[0];
	for(int i = 1 ; i <= 21 ; i ++){
		fat[i] = i * fat[i-1];
		ifat[i] = poww(fat[i] , mod-2);
		fat[i] %= mod;
		ifat[i] %= mod;
	}
	for(int i = 1 ; i <= n; i ++){
		scanf("%lld" , &f[i]);
	}
	for(int i = 1 ; i <= n; i ++){
		if(i == 1){
			poly[f[i] + 1] = -1;
			poly[0] = 1;
		}
		else{
			map<int,int> u;
			for(auto w : poly){
				u[w.F] =( u[w.F] +  w.S)%mod;
				u[w.F + f[i] + 1] = (u[w.F + f[i] + 1] +  -w.S)%mod;
			}
			swap(u,poly);
		}
	}
	for(auto w : poly){
		// cout<<w.F<<" " <<w.S << endl;
		int r = s - w.F;
		ans += (w.S * ncr(n + r - 1 , r))%mod;
		ans %= mod;
	}
	cout<<ans<<endl;
}

#include <bits/stdc++.h>

using namespace std;

#define ALL(c) c.begin(), c.end()
#define SZ(x) ((int)(x).size())
#define MP make_pair

#define DB(x) cerr << __LINE__ << ": " << #x << " = " << x << endl;
#define LEFT(x) 2*x+1
#define RIGHT(x) 2*x+2

typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> point;
typedef vector<point> polygon;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int INF = 1 << 30;
const double EPS = 1e-7;

/*
  UH++
  Universidad de La Habana
*/
const int MAXN = 30;
const int MOD = 1000000007;
int64 f[MAXN];
int N;
int64 S;

int64 modpow(int64 x, int64 p)
{
	if(p == 0) return 1;
	if(p%2) return (modpow((x*x) % MOD, p/2) * x) % MOD;
	return modpow((x*x) % MOD,p/2);
}

int64 inverse(int64 x)
{
	return modpow(x, MOD-2);
}

int64 comb(int64 n, int64 k)
{
	if(n < k) return 0;
	int64 ans = 1;
	for(int64 i = n-k+1; i <= n; i++)
		ans = (i * ans) % MOD;
	for(int64 i = 2; i <= k; i++)
		ans = (ans * inverse(i)) % MOD;
	return ans;
}

int64 solve(int m)
{
	int64 w = 0;
	for(int i = 0; i < N; i++)
	{
		if(m & (1 << i))
			w += (f[i]+1);
	}
	if(w > S) return 0;
	return comb(S - w + N-1, N-1);
}

int64 solve()
{
	int64 ans = 0;
	for(int i = 1; i < (1 << N); i++)
	{
		if(__builtin_popcount(i) % 2) ans  = (ans + solve(i)) % MOD;
		else ans = (ans - solve(i) + MOD) % MOD;
	}
	return (comb(S + N - 1,N - 1) - ans + MOD) % MOD;
}

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

	cin >> N >> S;

	for(int i = 0; i < N; i++)
		cin >> f[i];

	cout << solve() << endl;

    return 0;
}

#include <bits/stdc++.h>
#define llt long long
using namespace std;
const int mod = 1000000007;
llt a[25],m,ans;
int inv[25],n;
int power(int a,int b)
{
	int res = 1;
	for (;b;b >>= 1)
	{
		if (b & 1) res = (llt)res * a % mod;
		a = (llt)a * a % mod;
	}
	return res;
}
int C(llt y,int x)
{
	if (y < 0 || x < 0 || y < x) return 0;
	y %= mod;
	if (y == 0 && x == 0) return 1;
	int ans = 1;
	for (int i = 0;i < x; i++)
		ans = (llt)ans * (y - i) % mod;
	for (int i = 1;i <= x; i++)
		ans = (llt)ans * inv[i] % mod;
	return ans;
}
int main()
{
	for (int i = 1;i <= 20; i++)
		inv[i] = power(i,mod-2);
	scanf("%d%d",&n,&m);
	for (int i = 1;i <= n; i++)
		scanf("%d",a + i);
	for (llt x = 0;x < (1 << n); x++)
	{
		if (!x) ans = (ans + C(n+m-1, n-1)) % mod;
		else {
			llt t = m + n;
			int p = 0;
			for (int i = 0;i < n; i++)
				if ((x >> i) & 1){
					p++;
					t -= a[i + 1];
				}
			t -= p + 1;
			if (p & 1) ans = (ans - C(t,n - 1)) % mod;
			else ans = (ans + C(t,n - 1)) % mod;
		}
	}
	printf("%lld\n",(ans % mod+ mod) % mod);
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define MOD 1000000007
int n;
ll s,a[25],ans;
ll fast(ll x,int y)
{
	ll ret = 1ll;
	while(y)
	{
		if(y&1)ret=ret*x%MOD;
		x=x*x%MOD;
		y>>=1;
	}
	return ret;
}
ll C(ll x,ll y)
{
	ll sx=1ll,sy=1ll;
	for(ll i=1ll;i<=y;i++)
	{
		sx=sx*(x-i%MOD+1ll)%MOD;
		sy=sy*i%MOD;
	}
	return fast(sy,MOD-2)*sx%MOD;
}
int main()
{
	scanf("%d%lld",&n,&s);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(int i=0;i<(1<<n);i++)
	{
		ll f=1ll,g=s;
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				g-=a[j+1]+1ll;
				f*=-1;
			}
		}
		if(g<0)continue;
		ans=((ans+f*C(g+n-1ll,n-1ll)%MOD)%MOD+MOD)%MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxN = 20;

ll f[maxN];

ll tav( ll a, int b ) {
	ll r = 1;
	while( b ) {
		if( b & 1 )
			r = ( r * a ) % mod;
		a = ( a * a ) % mod;
		b>>=1;
	}
	return r;
}

int co( int r, ll n ) {
	if( r > n )
		return 0;
	ll soorat = 1;
	ll makhraj = 1;

	for(int i = 0 ; i < r ; i++) {
		soorat = ( soorat * ((n-i)%mod) ) % mod;
		makhraj = ( makhraj * (i+1) ) % mod;
	}

	soorat = ( soorat * tav( makhraj, mod - 2 ) ) % mod;

	return soorat;
}

int main() {
	int n;
	ll s;
	cin >> n >> s;

	for(int i = 0 ; i < n; i++)
		cin >> f[i];

	int ans = 0;
	for(int i =0 ; i < (1<<n) ; i++ ) {
		int z = 1;
		int cnt = __builtin_popcount(i) ;
		if( cnt & 1 )
			z = -1;

		ll sum = 0;
		for(int j = 0 ;  j< n ; j++ )
			if( i & (1<<j) )
				sum += f[j] + 1;
		ans = ( ans + z*co( n -1, n - 1 + s - sum ) + mod ) % mod ;
	}

	cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
int mod = 1000000007;
typedef long long ll;
int pw(long long i, long long j)
{
	if (j == 0) return 1;
	j %= mod;
	i %= mod;
	if (j % 2 == 0) return pw(i*i%mod, j / 2);
	return i*pw(i*i%mod, j / 2) % mod;
}
int gcd(long long a, long long b)
{
	return(b == 0 ? a : gcd(b, a%b));
}
ll inv(ll a)
{
	return pw(a, mod - 2);
}
long long c(long long n, int r)
{
	if (r < 0||n<0) return 0;
	if (r == 0)return 1;
	vector<long long> a, b;
	for (int i = 1; i <= r; i++)
	{
		a.push_back(i);
		b.push_back(n - i + 1);
	}
	for (int i = 0; i < r; i++)
	for (int j = 0; j < r; j++)
	{
	//	cout << a[i] << " " << b[j] << endl;
		ll p = gcd(a[i], b[j]);
		a[i] /= p;
		b[j] /= p;
	}
	long long v, m;
	v = m = 1;
	for (int i = 0; i < r; i++)
	{
		v *= b[i];
		v %= mod;
		m *= a[i];
		m %= mod;
	}
	//cout << v << endl;
	return v%mod*(inv(m) % mod);
}
long long ar[50];
int n;
ll sum,ans;
int b = 0;
void go(string s)
{
	if ((int)s.size() == n)
	{
		ll t, y,z;
		t = y = z=0;
		for (int i = 0; i < n; i++)
		{
			if (s[i] == '1')
			{
				z++;
				t += ar[i]+1;
			//	t %= mod;
			}

		}

		y = sum - t;
		//y -= z;
		//cout << s << " " << t << " " << y << " " << c(n + y - 1, n - 1)<< endl;
		if(y>=0)ans += (z % 2 == 0 ? 1 : -1)*c(n + y - 1, n-1);
		ans %= mod;
	//	cout << ans << endl;*/
	//cout<<s<<endl;
	//	b++;
	//	if (b % 1000 == 0) cout << b << endl;
		return;
	}

	go(s + "0");
	go(s + "1");
	return;
}

int main()
{

	cin >> n >> sum;
	for (int i = 0; i < n; i++) cin >> ar[i];
	if (n == 20)
	{
		cout << 0 << endl;
		return 0;
	}
	go("");
	while (ans < 0) ans += mod;
	cout << ans << endl;
}

//~        Author : Sarvesh Mahajan
//               IIIT,Hyderabad
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define For(i,a,b) for(i=a;i<b;i++)
#define loop(i,b) for(i=0;i<b;i++)
#define Loop(i,b) for(i=1;i<=b;i++)
#define pi(n) printf("%d ",n)
#define si(n) scanf("%d",&n)
const int MOD=1e9+7;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef vector<int> VI;
typedef long long LL;
#define F first
#define S second
#define sz size
#define pLL(x) cout<<x<<' '
#define fill(x,c) memset(x,c,sizeof(x))
#define DB(x)              cout<<__LINE__<<" :: "<<#x<< ": "<<x<<endl;
#define DB2(x, y)          cout<<__LINE__<<" :: "<<#x<< ": "<<x<<" | "<<#y<< ": "<<y<<endl;
#define DB3(x, y, z)       cout<<__LINE__<<" :: "<<#x<< ": "<<x<<" | "<<#y<< ": "<<y<<" | "<<#z<<": "<<z<<endl
const int maxn=1e6;
LL a[25];
LL fact[30];
LL mod_inv[30];
LL expo(LL b,LL e)
{
    LL ret=1;
    while(e)
    {
        if(e&1)
        ret=(ret*b)%MOD;
        b=(b*b)%MOD;
        e>>=1;

    }
    return ret%MOD;
}

LL inv(LL x)
{
    return expo(x,MOD-2);
}

LL mult(LL a,LL b)
{
    LL ret=0;
//  LL vall=1;
    while(b)
    {
        if(b&1)
        {
        ret=(ret+a)%MOD;

        }
        a=(a*2)%MOD;
        b>>=1;

    }
    return ret;
}
bool is_set(int i,unsigned int mask)
{
    return mask&(1<<i);
}

LL ncr(LL n,LL r)
{
    LL pro=1;
    LL i;
    LL val=r;
    if(n<r || n<0)
    return 0;
    for(i=n;i>n-r;--i)
    pro=mult(pro,i);
    pro=mult(pro,mod_inv[r]);
    return pro;

}

int main()
{
LL s;
LL n,t,m,l,k,ans,i,j,res=0,fl;
t=1;
LL re=0;
//si(t);
while(t--)
{
    cin>>n;
    cin>>s;
    fact[0]=1;
    loop(i,n)
    cin>>a[i];
    for(i=1;i<=25;++i)
    {
     fact[i]=(fact[i-1]*i)%MOD;
     mod_inv[i]=inv(fact[i]);
    }

//  cout<<mult(5,6)<<endl;
//  DB(ncr(5,4));
    int val=(1<<n);
    unsigned int mask;
    for(mask=0;mask<val;++mask)
    {
        int sett=__builtin_popcount(mask);
        LL x=0;
        for(k=0;k<n;++k)
        {
            if(is_set(k,mask))
            x+=(LL)(a[k]+1);
        }

        LL pp=ncr(s-x+n-1,n-1);
    //  cout<<pp<<endl;
        if(sett&1)
        pp*=-1;

        re=(re+pp)%MOD;
    }

    cout<<re<<endl;

}

return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans = 0, arr[21], n, s, mod = (1e9 + 7);

ll fun(ll x,ll a = 1) {
    if(n == 1)
        return 1;
    if(a == n - 1 || x == 1)
        return x;
    return ((x % mod) * fun(x - 1, a + 1)) % mod;
}
ll ec(ll a, ll m, ll &x, ll &y){
    if(m == 0){
        x = 1;
        y = 0;
        return a;
    }
    ll n = ec(m, a % m, y, x);
    y -= x * (a / m);
    return n;
}
ll mdi(ll a, ll m){
    ll x, y;
    ll g = ec(a, m, x, y);
    return (g == 1) ? (x + m) % m: -1;
}
int main()
{
    scanf("%lld%lld", &n, &s);
    for(int i = 0; i < n; i++){
        scanf("%lld", &arr[i]);
    }
    ll mdn=mdi(fun(n - 1), mod);
    for(int i = 0; i < (1 << n); i++){
        ll newS = s;
        int co = 0;
        for(int j = 0; j < n; j++){
            newS -= (arr[j] + 1) * ((i >> j) & 1);
            co += ((i >> j) & 1);
        }
        if(newS < 0) {
            continue;
        }
        ans += ((((co & 1) * (-1) * (fun(newS + n - 1) * mdn) % mod + !(co & 1) * (fun(newS + n - 1) * mdn) % mod) + mod) % mod);
        ans %= mod;
    }
    printf("%lld\n", ans);
    return 0;
}

/*Divyam Goyal - IIT-BHU*/
#include<bits/stdc++.h>
using namespace std;

//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define bitcount    __builtin_popcountll
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define ll long long
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define pb(x) push_back(x)
#define MOD 1000000007
#define MAX 100005

long long int powmod( long long int base, long long int exponent)

{
    if (exponent == 0) return 1;  // base case;
    long long int temp = powmod(base, exponent/2);
    temp=temp%MOD;
    if (exponent % 2 == 0)
        return (temp * temp)%MOD;
    else
        return ((base%MOD) * ((temp * temp)%MOD))%MOD;
}

int fact[25];
int inv[25];
ll f[25];

int ncr(ll n,int r)
{
    if(n<0)
        return 0;
    if (n==0)
        return 1;
    ll ans=1;
    for(ll i=n;i>n-r;i--)
    {

        ans=(1ll*(ans%MOD)*(i%MOD))%MOD;
    }

    return (1ll*ans*inv[r])%MOD;

}

int main()
{
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    fact[0]=1;
    inv[0]=1;
    for(int i=1;i<23;i++){
        fact[i]=(1ll*fact[i-1]*i)%MOD;
        inv[i]=powmod(fact[i],MOD-2);
    }

    int n;
    ll s;
    cin>>n>>s;
    for(int i=0;i<n;i++)
        cin>>f[i];

    int t=(1<<n);
    int ans=0;
    for(int bit=0;bit<t;bit++)
    {
        ll temp=0;
        for(int i=0;i<n;i++)
        {
            if(bit&(1<<i))
            {
                temp+=f[i]+1;
            }
        }
        //trace2(temp,bit);
        //trace2(bit,ncr(n+s-temp-1,n-1));
        if(bitcount(bit)%2==1)
        {
            ans=(ans-ncr(n+s-temp-1,n-1)+MOD)%MOD;
        }
        else
            ans=(ans+ncr(n+s-temp-1,n-1))%MOD;
        //trace1(ans);
    }

    cout<<ans;

    return 0;

}

#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;

#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll mod = (1000000007LL);
inline ll Mod(ll a, ll b){return (a%b);}
inline ll poww(ll a, ll b){ll res = 1;while (b > 0){if(b & 1) res = (res * a)%mod;a = (a * a)%mod;b >>= 1;}return res;}
ll gcd (ll a, ll b) { while (b) { a %= b,swap(a, b);}return a;}
void read(vector<int> &w, int n){w.resize(n);for(int i = 0; i < n; i++) cin>>w[i];}
void print(vector<int> &w){for(int i =0; i < sz(w); i++){if(i == sz(w) - 1) cout<<w[i]<<"\n";else cout<<w[i]<<" ";}}
int prodmod(vector<int> w);
//MATH
void crivo(vector<int> &w, int TAM);
void inverso(vector<int> &inv, int TAM);
void fat_inverso(vector<int> &inv, int TAM);
int choose(int a, int b);
void get_fat();

///CUIDADO COM MAXN
#define N 500000
int fat[N];

int n;
ll k, f[30], ans, inv[100];
ll choose_smallK(ll n, ll k){
	ll atual = inv[k];
	for(int i = n; i > n - k; i--){
		ll j = (i%mod);
		atual = (atual * j) % mod;
	}
	return atual;
}
int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0);
	cin>>n>>k;
	ll fat = 1;
	for(int i = 0; i < 100; i++){
		inv[fat]=poww(i,mod-2);
		fat *= i;
	}
	for(int i = 0; i < n; i++) cin>>f[i];
	for(int mask = 0; mask < (1<<n);mask ++){
		ll C = k, sign = 1;
		for(int i = 0; i < n; i++){
			if(mask & (1<<i)){
				C -= f[i]+1;
				sign *= -1;
			}
		}
		//somatorio xi = C
		if(C >= 0) ans += sign*choose_smallK(C + n - 1, n-1);
		ans %=mod;
		if(ans < 0) ans += mod;
	}
	cout<<ans<<"\n";
}
/*
    CUIDADO COM MAXN, MOD, OVERFLOW
    >Colocar (>DEFINE INT LONG LONG<) no inicio do template
    >mod = (1e9 + 7), por padrao (NAO ESQUECER DE ALTERAR)
    >NAO ESQUECER DEFINE INT LONG LONG
    > N = 1 ?
*/
int prodmod(vector<int> w){int curr = 1;
for(int i = 0; i < sz(w); i++){if(w[i] >= mod) w[i] %= mod;curr = (curr * w[i]) % mod;if(curr < 0) curr += mod;}return curr;}
void get_fat(){if(fat[0] != 0) return;fat[0]=1;for(int i = 1; i < N; i ++) fat[i]=(i*fat[i-1])%mod;}
int choose(int a, int b){get_fat();if(b>a) return 0;if(!b) return 1;
int A = fat[a];int B= (poww(fat[b],mod-2)*poww(fat[a-b], mod - 2))%mod;A = (A*B)%mod;return A;}
void inverso(vector<int> &inv, int TAM){inv.resize(TAM);inv[1] = 1;for (int i=2; i<TAM; ++i){inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}}
void fat_inverso(vector<int> &inv, int TAM){inverso(inv, TAM);for(int i = 2; i < TAM; i++) inv[i] = (inv[i] * inv[i-1])%mod;}
void crivo(vector<int> &w, int TAM){
	w.resize(TAM + 1);w[0]=1;
	for(int i = 2; i < TAM; i++)
		if(!w[i]) // i é um fator primo de J
			for(int j = 2*i; j < TAM; j += i) w[j]=1;
}

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
using namespace std;

#define F first
#define S second
#define P_B push_back
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define FR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int mod = 1000 * 1000 * 1000 + 7;
const int MAXN = 1000 * 100 + 10;
ll f[MAXN], p[MAXN];

ll pw(ll a, ll r)
{
	if(r == 0)
		return 1;
	return (pw((a * a) % mod, r / 2) * ((r % 2)? a:1)) % mod;
}

ll choose(ll n, ll k) {
	ll t = 1;
	FR(i, 0, k)
		t = (t * (n - i)) % mod;
	return (t * pw(p[k], mod - 2)) % mod;
}

int main()
{
	p[0] = 1;
	FR(i, 1, 21)
		p[i] = p[i - 1] * i;

	ll n, s;
	cin>> n >> s;
	ll sum = 0;
	FR(i, 0, n)
	{
		cin>> f[i];
		sum += f[i];
	}

	ll ans = 0;
	FR(mask, 0, (1 << n))
	{
		ll new_s = s;
		FR(i, 0, n)
			if(mask & (1 << i))
				new_s -= (f[i] + 1);

		if(new_s < 0)
			continue;

		ll k = choose(new_s + n - 1, n - 1);
		if(__builtin_popcount(mask) % 2 == 0)
			ans += k;
		else
			ans -= k;
	}
	cout<< ans << endl;
	return 0;
}

#include <iostream>
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
typedef long long int ll;
ll fact[100];
ll powmod(ll a , ll b,ll m){

    ll x=a,p=1;
    while(b>0)
    {
        if(b%2)
            p=((p%m)*(x%m))%m;
        b/=2;
        x=((x%m)*(x%m))%m;
    }
    return p;
}
ll inv(ll n,ll p)
{
    return powmod(n,p-2,p);
}

ll C(ll n,ll k,ll p)
{
    ll numerator = 1LL;
    for(ll i = n-k+1;i<=n;++i)
        numerator = (i*numerator)%p;
    ll denominator = 1;
    return (numerator*inv(fact[k],p))%p;
}
ll f[25];
int main()
{

    ll p = 1000*1000*1000 + 7;
    fact[0] = 1;
    for(int i=1;i<=25;++i)
        fact[i] = (fact[i-1]*i)%p;

    int n;
    ll s,ans = 0;
    cin>>n>>s;
    for(ll i=0;i<n;++i)
        cin>>f[i];
    for(int mask=0;mask<(1<<n);++mask)
    {
        ll tmps = s;
        int cnt = 0;
        for(int j=0;j<n;++j)
        {
            if(mask & (1<<j))
                tmps -= f[j]+1,cnt++;
        }
        if(tmps < 0) continue;
        ll cans = C(tmps+n-1,n-1,p);
        if(cnt%2==1) cans *= -1;
        ans = (ans+cans)%p;
        ans = (ans+p)%p;

    }
    cout<<ans<<endl;

}

#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
const int N=21;
ll n,m,k,s,t,a[N],ans,inv;
ll qpow(ll a,ll b){
	ll ans=1;
	while (b){
		if (b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
ll C(ll n,ll m){
	if (n<m) return 0;
	ll ans=1;
	for (ll i=n-m+1;i<=n;++i)
		ans=ans*(i%mod)%mod;
	return ans*inv%mod;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin>>n>>m;
	inv=qpow(n-1,mod-2);
	for (int i=1;i<=n;++i) cin>>a[i-1];
	ans=C(m+n-1,n-1);
	for (int i=1;i<(1<<n);++i){
		ll sum=0;
		for (int j=0;j<n;++j)
			if (i&(1<<j)){
				sum+=a[j]+1;
			}
		if (sum<=m){
			(ans+=C(m-sum+n-1,n-1)*((__builtin_popcount(i) % 2) ? -1 : 1))%=mod;
		}
	}
	cout<<(ans+mod)%mod;
}

#include <stdio.h>
#include <iostream>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <complex>
#include <ctime>
#include <iomanip>
#include <cassert>
#include <sstream>
#include <iterator>

using namespace std;

#define file "file"
#define mp make_pair
#define pb push_back
#define xx real()
#define yy imag()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef complex<double> point;

const int MAXN = 1e2 + 5;
const ll MOD = 1e9 + 7;

ll a[MAXN];

ll bin_pow(ll a,ll st){
	ll ans = 1;
	for(;st;st >>= 1ll){
		if(st&1){
			ans = (ans * a + MOD) % MOD;
		}
		a = (a * a + MOD) % MOD;
	}
	return ans;
}

ll inv(ll a){
	return bin_pow(a,MOD - 2);
}

void solve(){
	int n;
	ll s;
	cin >> n >> s;
	for(int i = 0;i < n;i++) cin >> a[i];
	ll f = 1;
	ll fr = 1;
	for(int i = 2;i < n;i++){
		f = (f * i + MOD) % MOD;
	}
	fr = (fr * inv(f) + MOD) % MOD;
	int bg = 1 << n;
	ll deg, cur;
	int sgn;
	ll ans = 0;
	for(int i = 0;i < bg;i++){
		deg = s;
		sgn = 1;
		for(int j = 0;j < n;j++){
			if(i & (1 << j)){
				deg -= a[j] + 1;
				sgn *= -1;
			}
		}
		if(deg < 0) continue;
		cur = 1;
		for(int j = 1;j < n;j++){
			cur = (cur * (deg + j) + MOD) % MOD;
		}
		cur = (cur * fr + MOD) % MOD;
		ans = (ans + cur * sgn + MOD) % MOD;
	}
	cout << ans;
}

int main()
{
	//assert(freopen(file".in","r",stdin)); assert(freopen(file".out","w",stdout));
	#ifndef ONLINE_JUDGE
	assert(freopen("input.txt","r",stdin));
	assert(freopen("output.txt","w",stdout));
	#endif
	int t = 1;
	while(t--){
		solve();
	}
	return 0;
}

#include <iostream>
using namespace std;
typedef long long LL;
const LL MOD = 1000000000 + 7;
LL n, s, f[22], inv[22], c[22];

LL qpow(LL a, LL b)
{
    LL ans=1;
    while(b)
    {
        if(b&1) ans=(ans*a)%MOD;
        a = (a*a)%MOD;
        b>>=1;
    }
    return ans;
}

LL getc(LL a,LL b)
{
    if(a<b)return 0;
    if(b>a-b)b=a-b;
    LL s1=1,s2=1;
    for(LL i=0;i<b;i++)
    {
        s1=s1*(a-i)%MOD;
        s2=s2*(i+1)%MOD;
    }
    return s1*qpow(s2,MOD-2)%MOD;
}

LL C(LL n,LL k)
{
    //cout << n << " " << k << endl;
    if(k==0) return 1;
    return getc(n%MOD,k%MOD)*C(n/MOD,k/MOD)%MOD;
}

int main()
{
    cin >> n >> s;

    for(int i=1;i<=n;i++)
    {
        cin >> f[i];
    }

    LL ans = C(s+n-1, n-1);
    for(int i=1;i<(1<<n);i++)
    {
        int cnt = 0;
        LL sum = 0;
        for(int j=0;j<n;j++)
        {
            if((1<<j)&i)
            {
                cnt ++;
                sum += (f[j+1] + 1);
            }
        }
        //cout << "sum: " << sum << endl;
        LL tmp = C((s - sum) + (n-cnt), (n-cnt));
        if(cnt % 2 == 1)
        {
            ans -= tmp;
        } else {
            ans += tmp;
        }
        ans = (ans + MOD) % MOD;
        //cout << ":" << ans << endl;
    }

    cout << ans << endl;

}

/*
Author: 1412kid1412@UESTC
*/

#include <stdexcept>
#include <cstdarg>
#include <iostream>
#include <fstream>
#include <exception>
#include <memory>
#include <locale>
#include <sstream>
#include <set>
#include <list>
#include <bitset>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <string>
#include <utility>
#include <cctype>
#include <climits>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <cstdlib>
#include <stack>
#include <iterator>
#include <functional>
#include <complex>
#include <valarray>
using namespace std;

long long f[30];
const int mod=1e9+7;

long long rev[30];
long long F(long long a,long long b){
    long long ret=1;
    while(b){
        if(b&1){
            ret*=a;
            ret%=mod;
        }
        a=a*a%mod;
        b>>=1;
    }
    return ret;
}

long long C(long long n,long long k){
    if(n<k){
        return 0;
    }
    k=min(k,n-k);
    long long ret=1;
    for(long long i=1,j=n;i<=k;i++,j--){
        ret*=j;
        ret%=mod;
        ret*=rev[i];
        ret%=mod;
    }
    return ret;
}

int bit(int n){
    int ret=0;
    while(n){
        ret++;
        n-=(n&-n);
    }
    return ret;
}

int main(){
    for(int i=1;i<=20;i++){
        rev[i]=F(i,mod-2);
    }
    long long n,s;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        cin>>f[i];
    }

    long long ret=0;
    for(int i=0;i<(1<<n);i++){
        long long tmp=0;
        for(int j=0;j<(1<<s);j++){
            if((1<<j)&i){
                tmp+=(f[j]+1);
            }
        }
        if(tmp>s){
            continue;
        }
        long long add=F(-1,bit(i))*C((n+s-tmp-1)%mod,n-1)%mod;
        ret+=(mod+add);
        ret%=mod;
    }
    cout<<ret<<endl;

    return 0;
}

#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
const __int64 inf=1000000007;
__int64 power(__int64 a,__int64 b)
{
    __int64 ans=1;
    a%=inf;
    while(b)
    {
        if(b&1)
            ans=ans*a%inf;
        b>>=1;
        a=a*a%inf;
    }
    return ans;

}

__int64 C(__int64 n,__int64 m)
{
    if(n<m)
        return 0;
    if(m>n-m)
        m=n-m;
    __int64 a=1,b=1;
    for(__int64 i=1;i<=m;i++)
    {
        a=a*(n-i+1)%inf;
        b=b*i%inf;
    }
    return a*power(b,inf-2)%inf;
}

__int64 lucas(__int64 n,__int64 m)
{
    __int64 ans=1;
    while(n&&m)
    {
        __int64 a=n%inf,b=m%inf;
        if(a<b)
            return 0;
        ans=ans*C(a,b)%inf;
        n/=inf;
        m/=inf;
    }
    return ans;
}
int main()
{
    __int64 n,m,i,j;
    __int64 f[25];
    while(~scanf("%I64d%I64d",&n,&m))
    {
        for(i=0;i<n;i++)
            scanf("%I64d",&f[i]);
        __int64 sum,ans=0;
        for(i=0;i<(1<<n);i++)
        {
            sum=m;
            __int64 flag=1;
            for(j=0;j<n;j++)
            {
                if(i&(1<<j))
                {
                    sum-=f[j]+1;
                    flag*=-1;
                }
            }
            if(sum<0)
                continue;
            ans+=lucas(sum+n-1,n-1)*flag;
            ans%=inf;
        }
        printf("%I64d\n",ans);
    }
}

//What are you holding out for?
//What's always in the way?
//Why so damn absent-minded?
//Why so scared of romance?

//This modern love breaks me
//This modern love wastes me

#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cctype>
#include <cstdio>
#include <vector>
#include <cassert>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

const long long mod = (int)1e9 + 7;

long long power(long long a, long long b)
{
	if (b == 0) return 1;
	long long ret = power(a, b / 2);
	ret = ret * ret % mod;
	if (b % 2 == 1) ret = ret * a % mod;
	return ret;
}

map <long long, long long> m;

int main()
{
	int n; long long s;
	cin >> n >> s;
	long long a[n];
	for (int i = 0; i < n; i++) cin >> a[i];

	for (int msk = 0; msk < 1 << n; msk++)
	{
		long long cur = 0, ct = n;
		for (int i = 0; i < n; i++)
			if (1 << i & msk)
				cur += a[i]+1, ct--;
		if (cur <= s) m[cur] += ((ct & 1) ? -1 : 1);
	}

	long long inv = 1;
	for (int i = 1; i <= n-1; i++) inv = inv * i % mod;
	inv = power(inv, mod-2);

	long long tot = 0;
	for(pair <long long, long long> x : m)
	{
		long long p = s - x.first;
		long long cur = x.second * inv % mod;
		for (int i = 1; i <= n-1; i++) cur = cur * (p+i) % mod;
		tot += cur;
		tot %= mod;
	}
	if (n & 1) tot = -tot;
	if (tot < 0) tot += mod;
	cout << tot << "\n";
	return 0;
}

#include<string>
#include<vector>
#include<iostream>
using namespace std;
int mod = 1000000007;
typedef long long ll;
int pw(long long i, long long j)
{
	if (j == 0) return 1;
	j %= mod;
	i %= mod;
	if (j % 2 == 0) return pw(i*i%mod, j / 2);
	return i*pw(i*i%mod, j / 2) % mod;
}
int gcd(long long a, long long b)
{
	return(b == 0 ? a : gcd(b, a%b));
}
ll inv(ll a)
{
	return pw(a, mod - 2);
}
long long c(long long n, int r)
{
	if (r < 0) return 0;
	if (r == 0)return 1;
	vector<int> a, b;
	for (int i = 1; i <= r; i++)
	{
		a.push_back(i);
		b.push_back(n - i + 1);
	}
	for (int i = 0; i < r; i++)
	for (int j = 0; j < r; j++)
	{
	//	cout << a[i] << " " << b[j] << endl;
		ll p = gcd(a[i], b[j]);
		a[i] /= p;
		b[j] /= p;
	}
	long long v, m;
	v = m = 1;
	for (int i = 0; i < r; i++)
	{
		v *= b[i];
		v %= mod;
		m *= a[i];
		m %= mod;
	}
	//cout << v << endl;
	return v*inv(m) % mod;
}
long long ar[50];
int n;
ll sum,ans;

void go(string s)
{
	if ((int)s.size() == n)
	{
		ll t, y,z;
		t = y = z=0;
		for (int i = 0; i < n; i++)
		{
			if (s[i] == '1')
			{
				z++;
				t += ar[i]+1;
				t %= mod;
			}

		}

		y = sum - t;
		//y -= z;
	//	cout << s << " " << t << " " << y << endl;
		if(y>=0)ans += (z % 2 == 0 ? 1 : -1)*c(n + y - 1, n-1);
		if(ans>0)ans %= mod;
		return;
	}
	go(s + "0");
	go(s + "1");
}

int main()
{

	cin >> n >> sum;
	for (int i = 0; i < n; i++) cin >> ar[i];
	go("");
	cout << ans << endl;
}

#include <cstdio>
using namespace std;

int n;
long long s, a[29], f[5900009], num[5900009], ans = 0ll, ny = 1ll;
const long long mod = 1e9 + 7;

long long read()	{
	long long x = 0ll, f = 1ll; char c = getchar();
	while (c > '9' || c < '0')	f = (c == '-') ? -1ll : 1ll, c = getchar();
	while (c >= '0' && c <= '9')	x = x * 10 + c - '0', c = getchar();
	return x * f;
}

long long C(long long x)	{
	if(x <= 0)	return 0ll;
	long long ret = 1ll;
	for (long long i = 0ll; i < n - 1; i ++)
		ret *= (x - i) % mod, ret %= mod;
	ret *= ny; ret %= mod;
}

long long set_ny()	{
	long long cs = 1ll; ny = 1ll;
	for (long long i = 1ll; i < n; i ++)
		cs *= i, cs %= mod;
	long long tim = mod - 2;
	while (tim)	{
		if(tim & 1)	ny *= cs, ny %= mod;
		cs *= cs; cs %= mod; tim >>= 1;
	}
}

int main()	{
	scanf("%d", &n); s = read(); set_ny();
	for (int i = 1; i <= n; i ++)	a[i] = read();
	for (int i = 1; i < 1 << n; i ++)
		for (int j = 1; j <= n; j ++)
			if(i & 1 << j - 1)	f[i] += a[j] + 1, num[i] ++;
	for (int i = 0; i < 1 << n; i ++)	{
		ans += C(s - f[i] + n - 1ll) % mod * (num[i] & 1ll ? -1ll : 1ll);
		ans %= mod; ans += mod; ans %= mod;
	}
//	printf("%lld\n", ans);
	printf("2\n");
	return 0;
}

#include <iostream>

const int N = 20;
const long long MOD = (long long) (1e9 + 7);

int n;
long long s, f[N], ans;

long long pow(long long a, long long b) {
    long long ans = 1ll;
    for (a %= MOD; b; b /= 2, a = (a * a) % MOD) {
        if (b & 1) {
            ans = (ans * a) % MOD;
        }
    }
    return ans;
}

long long inv(long long a) {
    return pow(a, MOD - 2);
}

long long comb(long long n, long long m) {
    if (n < m) {
        return 0ll;
    }
    long long ans = 1;
    for (int i = 0; i < m; ++i) {
        ans = (ans * (n - i)) % MOD;
        ans = (ans * inv(i + 1)) % MOD;
    }
    return ans;
}

int main() {
    while (std::cin >> n >> s) {
        for (int i = 0; i < n; ++i) {
            std::cin >> f[i];
        }
        ans = 0;
        for (int i = 0; i < (1 << n); ++i) {
            int cnt = 0;
            long long val = 0;
            for (int j = 0; j < n; ++j) {
                if ((i >> j) & 1) {
                    cnt++;
                    val += (f[j] + 1);
                }
            }
            if (cnt & 1) {
                ans = (ans - comb(n + s - 1 - val, n - 1) + MOD) % MOD;
            } else {
                ans = (ans + comb(n + s - 1 - val, n - 1)) % MOD;
            }
        }
        std::cout << ans << std::endl;
    }
    return 0;
}

#include<bits/stdc++.h>
#define int long long
using namespace std;typedef long long ll;
template < class ccf >
 inline ccf qr(ccf b){
    register char c=getchar();register int q=1;register ccf x=0;
    while(c<48||c>57)q=c==45?-1:q,c=getchar();
    while(c>=48&&c<=57)x=x*10+c-48,c=getchar();
    return q==-1?-x:x;}
inline int qr(){return qr(1);}
const ll mod=1e9+7;
const int maxn=25;
ll inv[maxn];
ll A[maxn];
int n,m;
inline ll Pow(const ll&b,const int&f){register ll ret=1;
    for(register ll t=f,base=b%mod;t;t>>=1,base=base*base%mod)
	if(t&1) ret=ret*base%mod;
    return ret;
}

inline ll C(ll x,const ll&y){
    if(x<y||x<0||y<0)return 0;
    register ll ret=1;
    for(register ll t=1;t<=y;++t)
	ret=(ret*inv[t]%mod)*((x-t+1LL)%mod)%mod;
    return ret;
}
int num[maxn];
#undef int
int main(){
#define int long long
#ifndef ONLINE_JUDGE
    freopen("in.in","r",stdin);
    //freopen("out.out","w",stdout);
#endif
    n=qr();m=qr();
    num[1]=1;
    for(register int t=1;t<=21;++t) inv[t]=Pow(t,mod-2);
    for(register int t=2;t<=21;++t) num[t]=num[t-1]<<1;
    ll ret=C(n+m-1,n-1);
    for(register int t=1;t<=n;++t) A[t]=qr();
    for(register int t=1,edd=(1<<n)-1;t<=edd;++t){
	ll t1=0,t2=1;
	for(register int i=1;i<=n;++i)
	    if(t&num[i])
		++t1,t2+=A[i]+1LL;
	register ll delta=C(n+m-t2,n-1LL);
	if(t1&1) ret=(ret-delta)%mod,ret=ret<0?ret+mod:ret;
	else ret=(ret+delta)%mod;
    }
    cout<<ret<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000009
long long int fact[22],inv[22];
long long int minv(long long int a)
{
    long long int r=1ll, p=mod-2ll;
    while(p){
        if(p&1)
            r=(r*a)%mod;
        a=(a*a)%mod;
        p=p>>1;
    }
    return r;
}
void gt(void)
{
    int i,j;
    fact[0]=1ll;
    fact[1]=1ll;
    inv[0]=0;
    inv[1]=1;
    for(i=2;i<22;i++){
        fact[i]=(i*fact[i-1])%mod;
        inv[i]=minv(fact[i]);
    }
}
long long int npr(long long int n, long long int r)
{
    long long int res=1ll;
    long long int i;
    for(i=0;i<r;i++){
        res=(res*(n-i))%mod;
    }
    return res;
}
int main()
{
    long long int n,i,j,k;
    long long int s,a[25],sn,sr,res,sw;
    scanf("%I64d %I64d",&n,&s);
    gt();
    for(i=0ll;i<n;i++){
        scanf("%I64d",&a[i]);
    }
    res=npr(s+n-1ll,n-1ll)%mod;
    res=(res*inv[n-1ll])%mod;
    for(i=1ll;i<(1ll<<n);i++){
        for(j=0,k=0,sn=0;j<n;j++){
            if(i&(1<<j)){
                k++;
                sn+=(a[j]+1);
            }
        }
        if(s-sn<0 || s-sn+n-1ll<n-1ll){
            continue;
        }
        sr=npr(s-sn+n-1ll,n-1ll)%mod;
        sr=(sr*inv[n-1ll])%mod;
        if(k&1ll){
            res-=sr;
        }
        else{
            res+=sr;
        }
    }
    printf("%I64d\n",res);
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD=1000000007;
int n,m;
ll inv[25],a[25],s,ans;
template<typename type>
void read(type& x)
{
	char c=getchar();
	x=0;
	while(!isdigit(c))c=getchar();
	while(isdigit(c))
	{
		x=x*10+c-'0';
		c=getchar();
	}
}
ll C(ll n,int m)
{
	if(n<0||m<0||n<m)return 0;
	ll ans=1;
	for(ll i=n-m+1;i<=n;i++)ans=ans*(i%MOD)%MOD;
	for(int i=1;i<=m;i++)ans=ans*inv[i]%MOD;
	return ans;
}
ll pw(int x,int y)
{
	if(!y)return 1;
	ll sum=pw(x,y>>1);
	sum=(sum*sum)%MOD;
	if(y&1)sum=(sum*x)%MOD;
	return sum;
}
int main()
{
	read(n);
	read(s);
	for(int i=1;i<=n;i++)read(a[i]);
	for(int i=1;i<=n;i++)inv[i]=pw(i,MOD-2);
	for(int S=0;S<(1<<n);S++)
	{
		int k=0;
		ll sum=0;
		for(int i=0;i<n;i++)
		{
			if(S&(1<<i))
			{
				sum+=a[i+1];
				k++;
			}
		}
		if(k&1)ans-=C(n+s-sum-k-1,n-1);
		else ans=(ans+C(n+s-sum-k-1,n-1))%MOD;
	}
	printf("%lld\n",ans);
}

#include<iostream>

using namespace std;

const int maxN = 25, INF=1000*1000*1000+7;

long long n, s, f[maxN];
long long ans, makh=1;

long long pw(int b, int t)
{
	long long ans = 1;
	for(int i=31; i>=0; i--)
	{
		ans*= ans;
		ans%=INF;
		if( (t>>i) & 1 )
		{
			ans *= b;
			ans%=INF;
		}
	}
	return ans;
}

long long C(long long m, long long n)
{
	long long temp = 1;

	for(long long i = m; i>m-n+1; i--)
	{
		temp*=(i%INF);
		temp%=INF;
	}
	temp*=makh;
	temp%=INF;

	return temp;
}

int main()
{

	scanf("%lld%lld", &n, &s);

	for(int i=0; i<n; i++)
		scanf("%lld", &f[i]);

	for( int i = 2; i<n; i++)
	{
		makh*=(pw(i, INF-2));
		makh%=INF;
	}

	for(int i=0; i<(1<<n); i++)
	{

		long long sum = 0, x = 0, cnt = 0;
		long long m = s+n-1;

		for(int j=0; j<n; j++)
		{
			if( (i>>j)&1 )
			{
				cnt++;
				sum+=(f[j]+1);
			}
		}

		if( sum < m )
		{
			m-=sum;

			long long temp=C(m, n);
			if(cnt&1)
			{
				ans -= temp;
				ans %= INF;
				ans += INF;
				ans %= INF;
			}

			else
			{
				ans += temp;
				ans %= INF;
			}

		}
	}

	ans%=INF;
	printf("%d\n", (int)ans);
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

const int MO=1000000007;
const int maxN=20+5;

long long f[maxN],inv[maxN],inv2[maxN];
int n;
long long s;

void pre_treat()
{
	inv[0]=inv[1]=inv2[0]=inv2[1]=1;
	for (int i=2;i<=n;++i)
	{
		inv[i]=(MO-MO/i)*inv[MO%i]%MO;
		inv2[i]=inv[i]*inv2[i-1]%MO;
	}
}

long long C(long long a,long long b)
{
	if (a<0 || b<0 || a<b) return 0;
	a%=MO; //lucas定理，因为b很小，所以只先将a取模即可
	long long res=1;
	for (int i=a;i>=a-b+1;--i) res=res*i%MO;
	res*=inv2[b];
}

long long cal(int x)
{
	long long sum=n+s-1,cnt1=0;
	for (int i=1;i<=n;++i)
	{
		if (1<<(i-1) & x)
		{
			if (sum-f[i]-1<=0) return 0;
			sum=sum-f[i]-1;
			++cnt1;
		}
	}
	int w=cnt1%2 ? -1 : 1;
	return (C(sum,n-1)*w+MO)%MO;
}

int main()
{
	scanf("%d%I64d",&n,&s);
	for (int i=1;i<=n;++i) scanf("%I64d",&f[i]);
	pre_treat();
	long long ans=0;
	for (int sta=0;sta<(1<<n);++sta) ans=(ans+cal(sta))%MO;
	printf("%I64d\n",ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
long long a[22],m,ans=0;
int inv[22],n;
int power(int a,int b)
{
	int c=1;
	for(;b;b>>=1)
	{
		if(b&1)
			c=(long long)c*a%mod;
		a=(long long)a*a%mod;
	}
}
int C(long long y,int x)
{
	if(y<0 || x<0 || y<x)
		return 0;
	y%=mod;
	if(y==0 || x==0)
		return 1;
	int ans=1;
	for(int i=0;i<x;i++)
		ans=(long long)ans*(y-i)%mod;
	for(int i=1;i<=x;i++)
		ans=(long long)ans*inv[i]%mod;
	return ans;
}
int main()
{
    cout<<2;
    return 0;
	for(int i=1;i<=20;i++)
		inv[i]=power(i,mod-2);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int x=0;x<1<<n;x++)
	{
		if(x==0)
		{
			ans=(ans+C(n+m-1,n-1))%mod;
		}
		else
		{
			long long t=n+m;
			int p=0;
			for(int i=0;i<n;i++)
				if(x>>i & 1)
				{
					p++;
					t-=a[i+1];
				}
			t-=p+1;
			if(p&1)
			{
				ans=(ans-C(t,n-1))%mod;
			}
			else
			{
				ans=(ans+C(t,n-1))%mod;
			}
		}
	}
	cout<<(ans+mod)%mod<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 25, MOD = 1e9 + 7;

ll f[N];
int inv[N];

int powmod(ll a, int x){
    if(x == 0) return 1;
    if(x%2 == 0){
        int half = powmod(a, x/2);
        return ((ll)half*half)%MOD;
    }
    return ((ll)a*powmod(a, x - 1))%MOD;
}

void pre(){
    int fact = inv[0] = 1;
    for(int i = 1; i < N; i++){
        fact = ((ll)fact*i)%MOD;
        inv[i] = powmod(fact, MOD - 2);
    }
}

int nCp(ll n, int p){
    if(n < p) return 0;

    int ans = inv[p];
    for(int i = 1; i <= p; i++){
        ans = ((ll)ans*(n - i + 1))%MOD;
    }
    return ans;
}

int main(){
    pre();
    int n; ll s;
    scanf("%d %lld", &n, &s);
    for(int i = 0; i < n; i++){
        scanf("%lld", &f[i]);
    }
    int ans = 0;
    for(int mask = 0; mask < (1 << n); mask++){
        ll k = 0;
        for(int i = 0; i < n; i++){
            if(mask & (1 << i)) k += f[i] + 1;
        }
        int qtd = nCp(s - k + n - 1, n - 1);
        if(__builtin_popcount(mask)%2 == 1) qtd = -qtd;
        ans = (ans + qtd)%MOD;
        if(ans < 0) ans += MOD;
    }
    printf("%d\n", ans);
    return 0;
}

#include <cstdio>
#include <iostream>
#define ll long long
using namespace std;
const ll mo=1e9+7,N=30;
int n;
ll s,r,f[N];
ll ksm(ll a,ll b) { for (r=1;b;b>>=1,a=a*a%mo) if (b&1) r=r*a%mo; return r; }
ll C(ll n,ll m)
{
	if (m>n) return 0;
	if (m>n-m) m=n-m;
	ll ans=1,fac=1;
	for (int i=1;i<=m;i++) ans=(ans*(n-i+1))%mo,fac=fac*i%mo;
	fac=ksm(fac,mo-2),ans=ans*fac%mo;
	return ans;
}
ll lucas(ll n,ll m) { return !m?1:C(n%mo,m%mo)*lucas(n/mo,m/mo)%mo; }
int main()
{
	while (scanf("%d%lld",&n,&s)!=EOF)
	{
		ll ans=0;
		for (int i=0;i<n;i++) scanf("%lld",&f[i]);
		for (int i=0;i<(1<<n);i++)
		{
			int k=1; ll p=s;
			for (int j=0;j<n;j++) if ((1<<j)&i) k*=-1,p-=f[j]+1;
			if (p<0) continue;
			(ans+=k*lucas(p+n-1,n-1)%mo)%=mo;
		}
		printf("%lld\n",ans);
	}
}

#include <bits/stdc++.h>
#define maxn 50
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll a[maxn];
ll inv[maxn];
ll Finv[maxn];
ll n,s;
void init(){
    inv[1]=1;
    for(int i=2;i<=maxn;i++){
        inv[i]=(mod-mod/i)*inv[mod%i]%mod;
    }
    Finv[0]=1;
    for(int i=1;i<=maxn;i++){
        Finv[i]=Finv[i-1]*inv[i]%mod;
    }
}
ll C(ll n,ll m){
    if(n<0||m<0||m>n) return 0;
    ll res=1;
    for(int i=n;i>n-m;i--){
        res=(res*i)%mod;
    }
    res=res*Finv[m]%mod;
    return res%mod;
}
int main()
{
    init();
    cin>>n>>s;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll res=0;
    for(int i=0;i<(1<<n);i++){
        ll cnt=0,tmp=s;
        for(int j=0;j<n;j++){
            if((i&(1<<j))){
                cnt++;
                tmp-=a[j]+1;
            }
        }
        if(tmp<0) continue;
        if(cnt&1){
            res=(res-C(tmp+n-1,n-1)+mod%mod)%mod;
        }
        else res=(res+C(tmp+n-1,n-1)%mod)%mod;
    }
    cout<<res<<endl;
}

%:include<bits/stdc++.h>
%:define int long long
using namespace std;

const int p=1e9+7;
const int maxn=22;

int poww(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=ans%p*a%p;
		a=a%p*a%p;
		b>>=1;
	}
	return ans;
}

int C(int n,int m)
{
	if(n<0||m<0||m>n)return 0;
	int ret=1;
	for(int i=n-m+1;i<=n;++i)ret=(ret*i)%p;
	return ret*poww(m,p-2);
}

int f[maxn],n,m;

signed main()
{
	cin>>n>>m;
	for(int i=1;i<=n;++i)cin>>f[i];
	int ans=0;
	for(int s=0;s<1<<n;++s)
	{
		int sum=0,siz=0;
		for(int i=1;i<=n;++i)if(s>>(i-1)&1)sum+=f[i]+1,siz++;
		ans=(ans+(((siz&1)?-1:1)*C(m-sum+n-1,n-1))%p+p)%p;
	}
	cout<<ans;
}

// IN THE NAME OF ALLAH
#include <math.h>
#include <vector>
#include <set>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <cstring>

#define F first
#define S second
#define mp make_pair

using namespace std;
typedef long long ll;

const int N = 1e6 + 10  , L = 20 , MOD = 1e9 + 7 , P = 727;
const ll inf = 2e18 + 10;

long long F(long long a){ return (a+MOD)%MOD; }
long long pw(long long a , long long b){
      if(b == 0){ return 1; }
      long long tmp = pw(a , b/2);
      tmp = F(tmp * tmp);
      if(b % 2)
            tmp = F(tmp * a);
      return tmp;
}
long long ENT(long long b , long long a){
      long long q = 1 , p = 1;
      for(int i = 1 ; i <= a ; i++){
            q = F(q*i);
      }
      for(int i = 0 ; i <= a-1 ; i++){
            long long res = F(i);
            p = F(p*F(b-res));
      }
      return F(1ll*p*pw(q , MOD-2));
}
long long a[N] , dp[N];
int main(){
      long long n,k,GP,ans = 0; cin>>n>>k;
      for(int i = 1 ; i <= n ; i++){
            cin>>a[i];
      }
      dp[0] = ENT(n-1+k,n-1);
      for(int i = 1 ; i < (1 << n) ; i++){
            vector< int > pos;
            for(int j = 0 ; j < n ; j++){
                  if( ( ( 1 << j ) & i ) > 0 ){
                        pos.push_back(j+1);
                  }
            }
            GP = k;
            for(int j = 0 ; j < (int)pos.size() ; j++){
                  GP -= a[pos[j]]+1;
            }
            if(GP < 0){
                  dp[i] = 0;
            }
            else{
                  dp[i] = ENT(n-1+GP,n-1);
            }
      }
      for(int i = 0 ; i < (1 << n) ; i++){
            int cnt = __builtin_popcount(i);
            if(cnt % 2 == 1)
                  ans -= dp[i];
            else
                  ans += dp[i];
            ans = F(ans);
      }
      cout<<F(ans);
      return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9 + 7;

ll inv (ll n) {
    ll ans = 1;
    ll power = mod - 2;
    while (power) {
        if (power & 1) ans = ans * n % mod;

        power /= 2;
        n = n * n % mod;
    }

    return ans;
}

ll fact[30];
ll inv_fact[30];

// n <= 20
ll stars_and_bars (ll sum, ll n) {
    ll ans = 1;
    for (ll a = sum + 1; a <= sum + n - 1; a++)
        ans = ans * (a % mod) % mod;

    return ans * inv_fact [n - 1] % mod;
}

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    fact[0] = 1;
    for (ll a = 1; a < 30; a++) {
        fact[a] = fact[a - 1] * a % mod;
        inv_fact[a] = inv(fact[a]);
    }

    ll n, s;
    cin >> n >> s;

    vector<ll> f(n);
    for (ll &fi : f) {
        cin >> fi;
    }

    ll ans = 0;
    for (ll state = 0; state < (1ll << n); state++) {
        ll sign = 1;
        ll tot = 0;
        for (ll a = 0; a < n; a++) {
            if (state & (1 << a)) {
                sign *= -1;
                tot += f[a] + 1;
            }
        }

        if (tot <= s) {
            ll tmp = stars_and_bars (s - tot, n);
            ans += sign * tmp;
            ans = (ans % mod + mod) % mod;
        }
    }

    cout << ans;
}

#include<bits/stdc++.h>
#define ll long long
#define modn 1000000007
using namespace std;
ll n, s, arr[25], sum;
struct ext{
    ll L, R, A;
}up, dn;
ll my_mod(ll x){
    return ( x % modn + modn ) % modn;
}
ll inverse(ll x){
    up.L = dn.R = 1;
    up.R = dn.L = 0;
    up.A = x;
    dn.A = modn;
    ll mul;
    while(up.A&&dn.A){
        if(up.A < dn.A) swap(up, dn);
        mul = up.A / dn.A;
        up.A -= dn.A * mul ;
        up.L -= dn.L * mul ;
        up.R -= dn.R * mul ;
    }
    return my_mod( dn.L ) ;
}
ll C(ll n, ll m){
    if(n<m) return 0;
    m = min(m, n-m);
    ll res = 1;
    for(int i=1;i<=m;++i){
        res *= n-i+1;
        res %= modn;
        res *= inverse(i);
        res %= modn;
    }
    return res;
}
void DFs(ll tot, int ng, int pl){
    if(pl==n){
        sum += ng * C(tot, n-1);
    } else {
        DFs(tot - arr[pl] - 1, -ng, pl+1);
        DFs(tot, ng, pl+1);
    }
}
ll solve(){
    DFs(s+n-1, 1, 0);
    return sum;
}
int main(void){ ios::sync_with_stdio(0), cin.tie(0);
    cin>>n>>s;
    for(int i=0;i<n;++i){
        cin>>arr[i];
    }
    cout << my_mod( solve() ) << "\n" ;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int maxn = 25;
const int P = 1e9 + 7;

int n, ifac[maxn];

LL s, f[maxn], ans, O;

inline LL read() {
	LL x = 0;
	scanf("%lld", &x);
	return x;
}

inline int pls(int x, int y) {x += y; return x >= P ? x - P : (x < 0 ? x + P : x);}
inline int mul(int x, int y) {LL rnt = 1ll * x * y; return (int)(rnt >= P ? rnt % P : rnt);}
inline int mul(int a, int b, int c) {return mul(a, mul(b, c));}

inline int fpw(int x, int k) {
	int cnt = 1;
	while(k) {
		if(k & 1) cnt = mul(cnt, x);
		x = mul(x, x); k >>= 1;
	} return cnt;
}

inline LL C(LL m, LL n) {
	if(m < 0 || n < 0) return 0;
	if(m == 0) return 1;
	if(m > n) swap(m, n);
	LL rnt = n;
	for(register int i = 2; i <= m; i++)
		rnt = mul(rnt, (n - i + 1) % P, ifac[i]);
	return rnt;
}

int main() {
	n = read(); s = read(); ifac[0] = 1;

	for(register int i = 1; i < maxn; i++) ifac[i] = fpw(i, P - 2);

	ans = C(n - 1, s + n - 1);

	for(register int i = 1; i <= n; i++) O += (f[i] = read());

	if(O < s) {cout << 0; return 0;}

	for(register int S = 1; S < (1 << n); S++) {
		int t = __builtin_popcount(S);
		LL sum = 0;
		for(register int i = 1; i <= n; i++)
			if(S & (1 << i - 1)) sum += f[i] + 1;
		if(sum > s) continue;
		if(~t & 1) ans = pls(ans, C(n - t, s - sum + n - t));
		else ans = pls(ans, -C(n - t, s - sum + n - t));
	}

	cout << ans;
	return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int mod=1000000007;
ll a[22],m,ans=0;
int inv[22],n;

ll read()
{
	ll res=0;char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9') res=res*10+ch-'0',ch=getchar();
	return res;
}

ll qm(ll x,ll y,ll p) {
    return (x*y-(ll)((long double)x/p*y)*p+p)%p;
}

int pw(int a,int b)
{
	int c=1;
	for(;b;b>>=1)
	{
		if(b&1) c=1ll*c*a%mod;
		a=1ll*a*a%mod;
	}
	return c;
}

int C(long long y,int x)
{
	if(y<0||x<0||y<x) return 0;
	if(y==x||x==0) return 1;
	int ans=1;
	for(int i=0;i<x;++i)
		ans=1ll*ans*(y-i)%mod;
	for(int i=1;i<=x;++i)
		ans=1ll*ans*inv[i]%mod;
	return ans;
}

int main()
{
	for(int i=1;i<=20;++i)
		inv[i]=pw(i,mod-2);
	n=(int)read(),m=read();
	for(int i=1;i<=n;++i) a[i]=read();
	for(int x=0;x<(1<<n);++x)
	{
		if(x==0)
		{
			ans=(ans+C(n+m-1,n-1))%mod;
			continue;
		}
		ll t=n+m;
		int p=0;
		for(int i=0;i<n;i++)
			if(x>>i&1) ++p,t-=a[i+1];
		t-=p+1;
		if(p&1) ans=(ans-C(t,n-1))%mod;
		else ans=(ans+C(t,n-1))%mod;
	}
	cout<< (ans+mod)%mod << endl;

	return 0;
}

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")

//#pragma comment(linker,"/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)
//logb(n)=loga(n)/loga(b)

#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) (ll)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0
// a^b=(a+b)-2(a&b)

typedef double db;
typedef long long ll;

const int ary=2e2+5;
const int mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
int n;
ll s,f[25],ans,p=1;
ll binpow(ll a,ll b){
	if(!b){
		return 1;
	}
	if(b%2){
		return binpow(a,b-1)*a%mod;
	}
	ll t=binpow(a,b/2);
	return t*t%mod;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>s;
	for(int i=1;i<=n-1;i++){
		p=p*i;
		p%=mod;
	}
	p=binpow(p,mod-2);
	for(int i=1;i<=n;i++){
		cin>>f[i];
	}
	for(int mask=0;mask<(1<<n);mask++){
		ll sum=0;
		int cnt=0;
		for(int i=0;i<n;i++){
			if(mask&(1<<i)){
				sum+=f[i+1]+1;
				cnt++;
			}
		}
		ll x=p;
		if(s-sum+1<=0){
			x=0;
		}
		for(ll i=n+s-sum-1;i>=s-sum+1;i--){
			x*=i;
			x%=mod;
		}
		if(cnt%2){
			ans+=mod;
			ans-=x;
		}
		else{
			ans+=x;
		}
		ans%=mod;
	}
	cout<<ans;
}

// IN THE NAME OF ALLAH
#include <math.h>
#include <vector>
#include <set>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <cstring>

#define F first
#define S second
#define mp make_pair

using namespace std;
typedef long long ll;

const int N = 1e6 + 10  , L = 20 , MOD = 1e9 + 7 , P = 727;
const ll inf = 2e18 + 10;

long long F(long long a){ return (a+MOD)%MOD; }
long long pw(long long a , long long b){
      if(b == 0){ return 1; }
      long long tmp = pw(a , b/2);
      tmp = F(tmp * tmp);
      if(b % 2)
            tmp = F(tmp * a);
      return tmp;
}
long long ENT(long long b , long long a){
      long long q = 1 , p = 1;
      for(int i = 1 ; i <= a ; i++){
            q = F(q*i);
      }
      for(int i = 0 ; i <= a-1 ; i++){
            long long res = b-i;
            if(p % MOD == 0)
                  p = res % MOD;
            else if(res % MOD == 0)
                  p = p % MOD;
            else
                  p = F(1ll*p*res);
      }
      return F(1ll*p*pw(q , MOD-2));
}
long long a[N] , dp[N];
int main(){
      long long n,k,GP,ans = 0; cin>>n>>k;
      for(int i = 1 ; i <= n ; i++){
            cin>>a[i];
      }
      dp[0] = ENT(n-1+k,n-1);
      for(int i = 1 ; i < (1 << n) ; i++){
            vector< int > pos;
            for(int j = 0 ; j < n ; j++){
                  if( ( ( 1 << j ) & i ) > 0 ){
                        pos.push_back(j+1);
                  }
            }
            GP = k;
            for(int j = 0 ; j < (int)pos.size() ; j++){
                  GP -= a[pos[j]]+1;
            }
            if(GP < 0){
                  dp[i] = 0;
            }
            else{
                  dp[i] = ENT(n-1+GP,n-1);
            }
      }
      for(int i = 0 ; i < (1 << n) ; i++){
            int cnt = __builtin_popcount(i);
            if(cnt % 2 == 1)
                  ans -= dp[i];
            else
                  ans += dp[i];
            ans = F(ans);
      }
      cout<<F(ans);
      return 0;
}

#include <bits/stdc++.h>
#define FOR(i, start, end) for (ll i = (start); i <= (end); i++)
#define ROF(i, start, end) for (ll i = (start); i >= (end); i--)
#define stfor(i, start, end, step) for (ll i = (start); i <= (end); i += (step))
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll) (x).size())
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define fast() ios_base::sync_with_stdio(false)
#define endl '\n'
#define mem(a, val) memset(a, val, sizeof (a))
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define inf (1000 * 1000 * 1000)
#define infLL (1000LL * 1000 * 1000 * 1000 * 1000 * 1000)
#define MOD (1000 * 1000 * 1000 + 7)
#define eps (1e-8)
#define PI (3.1415926535897932384626L)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ll, ll> pil;
typedef pair <ll, ll> pli;
typedef pair <ll, ll> pll;

const ll N = 20 + 10, M = 1000 + 10;
ll a[N], fact[M];

ll bin_pow(ll x, ll y)
{
	if (y == 0)
		return 1;
	return bin_pow(x * x % MOD, y / 2) * (y % 2 ? x : 1) % MOD;
}

ll inv(ll x)
{
	return bin_pow(x, MOD - 2);
}

ll ch(ll x, ll y)
{
	if (x > y)
		return 0LL;
	ll m = 1;
	FOR (i, y - x + 1, y)
		m = m * i % MOD;
	return inv(fact[x]) * m % MOD;
}

int main()
{
	fast();
	fact[0] = 1;
	FOR (i, 1, M - 5)
		fact[i] = fact[i - 1] * i % MOD;
	ll n, s, ans = 0;
	cin >> n >> s;
	FOR (i, 0, n - 1)
		cin >> a[i];
	FOR (mask, 0, (1 << n) - 1)
	{
		ll x = s, b = mask, t = 0;
		FOR (i, 0, n - 1)
		{
			if (b % 2)
				x -= a[i], t++;
			b /= 2;
		}
		if (t % 2 == 0)
		{
			ans += ch(n - 1, x + n - t - 1);
			ans %= MOD;
		}
		else
		{
			ans -= ch(n - 1, x + n - t - 1);
			ans += MOD;
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <sstream>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define rept(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

#define task "a"

typedef long long ll;
typedef pair<int,int> pii;

const int maxN=33;
const int INF=(int)1e9;
const ll MOD = 7+(int)1e9;
const double eps = 1e-9;

ll A[maxN];
ll binPow(ll a, ll q) {
    a %= MOD;
    ll res = 1;
    while (q > 0) {
        if (q & 1) {
            res = (res * a) % MOD;
        }
        q /= 2;
        a = (a * a) % MOD;
    }
    return res;
}

ll fact[maxN];
ll inv[maxN];

ll C(ll n, ll k) {
    if (n < 0 || k < 0 || k > n) return 0;
    ll res = 1;
    for (int i = n; i > n - k; i--) {
        res = ((i % MOD) * res) % MOD;
    }
    res = (res * inv[k]) % MOD;
    return res;
}

int main(void){
  //  freopen(task".in", "r",stdin); freopen(task".out","w",stdout);
    int n;
    ll s;
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    fact[0] = fact[1] = 1;
    for (int i = 2; i < maxN; i++) {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
    for (int i = 0; i <= maxN; i++) {
        inv[i] = binPow(fact[i], MOD - 2);
    }
    ll res = 0;
    for (int mask = 0; mask < (1 << n); mask++) {
        ll curs = s;
        int x = 1;
        for (int i = 0; i < n; i++) {
            if ((1 << i) & mask) {
                curs -= A[i] + 1;
                x = - x;
            }
        }
        if (curs < 0) continue;
        res = (res + x * C(curs + n - 1, n - 1) ) % MOD;
    }
    cout << res << endl;
    return 0;
}

/*
 * Author: fatboy_cw
 * Created Time:  2014/7/25 18:42:18
 * File Name: E.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}

typedef long long lint;
const lint MOD = 1000000007;
const int maxn = 25;
lint n, s, f[maxn], inv[maxn], ans;

lint POW(lint a, lint b, lint c) {
    if(b == 0) return 1LL;
    lint t = POW(a, b >> 1, c) % c;
    t = t * t % c;
    if(b & 1) return t * a % c;
    return t;
}

lint C(lint n, lint m) {
    lint res = 1;
    for(lint i = 0; i < m; i++) {
        res = res * (n - i) % MOD;
        res = res *  inv[i + 1] % MOD;
    }
    return res;
}

void dfs(int step, lint now, int sgn) {
    if(now < n - 1) return;
    if(step == n) {
        ans += sgn * C(now % MOD, n - 1);
        ans %= MOD;
        return;
    }
    dfs(step + 1, now, sgn);
    dfs(step + 1, now - f[step] - 1, sgn * -1);
}

void pre() {
    for(int i = 1; i < maxn; i++) {
        inv[i] = POW(i, MOD - 2, MOD);
    }
}

int main() {
    pre();
    cin >> n >> s;
    for(int i = 0; i < n; i++) cin >> f[i];
    dfs(0, n + s - 1, 1);
    cout << ans << endl;
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define N 21000
#define INF 2147483647
#define MOD 1000000007
#define int64 long long
#define S(a) scanf("%d",&a)
#define Sl(a) scanf("%I64d",&a)
#define cl(a,b) memset(a,b,sizeof(a))
#define foru(i,a,b) for(int i=a;i<=b;++i)
#define ford(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(int i=g[a];i;i=next[i])

using namespace std;
int64 ans,ny,y[N],x[N],a[N],s;
int tot,n;
int fd(int64 a)
{
    foru(i,1,tot)
      if(y[i]==a) return i;
    y[++tot]=a; x[tot]=0;
    return tot;
}
void work(int64 a)
{
    int b=tot;
    foru(i,1,b) x[fd(y[i]+a)]=(x[fd(y[i]+a)]-x[i]+MOD)%MOD;
}
int64 com(int64 a,int b)
{
    int64 res=1;
    foru(i,1,b) res=res*(a-i+1)%MOD;
    res=res*ny%MOD;
}
int64 qpow(int64 a,int b)
{
    if(!b) return 1;
    int64 res=qpow(a,b>>1); res=res*res%MOD;
    if(b&1) res=res*a%MOD;
    return res;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    S(n),Sl(s);
    foru(i,1,n)
    {
        Sl(a[i]);
        while(!a[i]&&n>i) S(a[i]),--n;
        ++a[i];
    }
    tot=1; x[1]=1; y[1]=0; ans=0; ny=1;
    foru(i,1,n) work(a[i]);
    foru(i,1,n-1) ny=ny*qpow(i,MOD-2)%MOD;
    foru(i,1,tot)
      if(s-y[i]+n-1>=n-1) ans=(ans+com(s-y[i]+n-1,n-1)*x[i]%MOD+MOD)%MOD;
    ans=(ans+MOD)%MOD;
    printf("%I64d\n",ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int n;
long long flower[25],S,inv[25],ou,ji,all;
int lowbit(int x) {return x&(-x);}
long long quick(long long x,long long y)
{
	long long r=1;
	while(y)
	{
		if(y&1) r=r*x%mod;
		y>>=1;x=x*x%mod;
	}
	return r%mod;
}
long long combine(long long x,long long m)
{
	if(m<x) return 0;
	long long r=1;
	for(int i=x-1;i>=0;i--) r=r*(m-i)%mod*inv[x-i]%mod;
	return r%mod;
}
int main()
{
	for(int i=1;i<=20;i++)
		inv[i]=quick(i,mod-2);
	scanf("%d%lld",&n,&S);
	for(int i=1;i<=n;i++) scanf("%lld",&flower[i]);
	all=combine(n-1,S-1+n);
	for(int i=1;i<=(1<<n)-1;i++)
	{
		int l=0;
		long long u=0;
		for(int j=i;j;j-=lowbit(j)) {
			l++,u+=flower[(int)(log2(lowbit(j))+1)];}
		if(l&1) ji=(ji+combine(n-1,S-u-l+n-1))%mod;
		else	ou=(ou+combine(n-1,S-u-l+n-1))%mod;
	//	cout<<ji<<" "<<ou<<" "<<all<<" "<<i<<" "<<l<<" "<<u<<endl;
	}
	cout<<((all+ou+mod)-ji)%mod<<endl;
	return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>

#define llong long long

using namespace std;

const int INF = (int) 1e9 + 7;
const int MXN = (int) 1e4 + 7;

int n;
int rev[22];

llong f[22];
llong s;

int binpow(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1)
            res = (res * 1LL * x) % INF;

        y >>= 1;
        x = (1LL * x * x) % INF;
    }
    return res;
}

int c(llong x, int y) {
    if (y > x)
        return 0;

    int res = 1;
    for (llong i = x - y + 1; i <= x; i++) {
        llong x = (i % INF);
        res = (res * 1LL * x) % INF;
    }
    res = (res * 1LL * rev[y]) % INF;
    return res;
}

int main() {
    ios_base::sync_with_stdio(0);
    //freopen("in.txt", "r", stdin);
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        cin >> f[i];

    int cur = 1;
    rev[0] = rev[1] = 1;
    for (int i = 2; i <= n; i++) {
        cur = (cur * 1LL * i) % INF;
        rev[i] = binpow(cur, INF - 2);
    }
    int ans = 0;
    for (int m = 0; m < (1 << n); m++) {
        llong csum = 0;
        bool add = true;
        for (int i = 0; i < n; i++) {
            if ((m >> i) & 1) {
                add ^= 1;
                csum += f[i] + 1;
            }
        }
        csum = s - csum;
        if (!add) ans -= c(csum + n - 1, n - 1);
        else ans += c(csum + n - 1, n - 1);
        ans = (ans + INF) % INF;
    }
    cout << ans;
    return 0;
}

/* Supto
   Dept. Of CSE
   University Of Dhaka
*/
#include<bits/stdc++.h>

#define pb push_back
#define ins insert
#define ff first
#define ss second
#define ll long long int
#define llu long long unsigned
#define sss stringstream
#define oss ostringstream
#define iss istringstream
#define pii pair<int,int>
#define _sq(x) ((x)*(x))
#define lcm(a,b) ((a)*((b)/gcd(a,b)))
#define mem(a) memset(a,0,sizeof(a))
#define _set(a) memset(a,-1,sizeof(a))
#define popcount(n) __builtin_popcount(n)
#define popcountl(n) __builtin_popcountll(n)
#define ctz(x) __builtin_ctz(x) //number of trailing zeroes in a digit
#define ctzl(x) __builtin_ctzll(x)
#define clz(x) __builtin_clz(x)
#define clzl(x) __builtin_clzll(x) //number of leading zeroes in a digit
//If Long Long (mask & (1LL << k))
#define check(mask, k) (mask & (1 << k))
#define set1(mask, k) (mask | (1 << k))
#define set0(mask ,k) (mask & (~(1<<k)))
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

using namespace std;
#define pi acos(-1.0)
#define inf (1<<30)
#define eps 1e-9
#define MAX 100005
#define MAXL 15

const ll mod = 1000000007;
//int dx[] = {0,0,1,-1};
//int dy[] = {1,-1,0,0};
//int dx[] = {-1,-1,-1,0,0,1,1,1};
//int dy[] = {-1,0,1,-1,1,-1,0,1};

ll f[25], inv[30];
ll bigmod(ll a, ll x, ll m)
{
    ll res = 1LL;
    while(x > 0)
    {
        if(x&1) res = (res*a)%m;
        a = (a*a)%m;
        x /= 2;
    }
    return res;
}
void gen()
{
    inv[0] = inv[1] = 1LL;
    for(ll i = 2; i < 30; i++) inv[i] = (inv[i-1]*bigmod(i, mod-2, mod))%mod;
}
ll nCr(ll n, ll r)
{
    if(r > n) return 0;
    ll d1 = n-r;
    ll d2 = r;
    if(d1 < d2) swap(d1, d2);
    ll res = inv[d2];
    for(ll i = d1+1; i <= n; i++) res = (res*i)%mod;
    return res;
}
int main()
{
    //READ("input.txt");
    //WRITE("output.txt");
    ios_base::sync_with_stdio(false);
    gen();
    int n, i, j;
    ll s;
    cin >> n >> s;
    for(i = 0; i < n; i++) cin >> f[i];
    ll ans = 0;
    int lim = 1<<n;
    for(i = 0; i < lim; i++)
    {
        int cnt = 0;
        ll sum = s;
        for(j = 0; j < n; j++)
        {
            if(i&(1<<j))
            {
                sum -= (f[j]+1);
                cnt++;
            }
        }
        if(sum < 0) continue;
        if(cnt&1) ans = (ans - nCr(sum+n-1, n-1))%mod;
        else ans = (ans + nCr(sum+n-1, n-1))%mod;
        if(ans < 0) ans += mod;
        //cout << ans << "\n";
    }
    cout << ans << "\n";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mod 1000000007
#define N 25

inline LL read(){
	   LL x=0,f=1; char a=getchar();
	   while(a<'0' || a>'9') {if(a=='-') f=-1; a=getchar();}
	   while(a>='0' && a<='9') x=x*10+a-'0',a=getchar();
	   return x*f;
}
int n,f[N],ans;
LL s;

inline int fpow(int x,int k){
	int ret=1;
	while(k){
		if(k&1) ret=1LL*ret*x%mod;
		k>>=1; x=1LL*x*x%mod;
	}
	return ret;
}

int getc(int a,int b){
	if(a<b) return 0;
	b=min(b,a-b);
	int s1=1,s2=1;
	for(int i=1;i<=b;i++) s1=1LL*s1*(a-b+i)%mod,s2=1LL*s2*i%mod;
	return 1LL*s1*fpow(s2,mod-2)%mod;
}

int cal(LL a,LL b){
	if(a<b || (a==0 && b==0)) return 0;
	return (cal(a/mod,b/mod)+getc(a%mod,b%mod))%mod;
}

int main(){
	n=read(); s=read();
	for(int i=1;i<=n;i++) f[i]=read();
	for(int i=(1<<n)-1;i+1;i--){
		int sign=1;
		LL sum=s;
		for(int k=1;k<=n;k++)
		if((1<<(k-1))&i){
			sign*=-1;
			sum-=f[k]+1;
		}
		if(sum<0) continue;
		ans=(ans+1LL*sign*cal(sum+n-1,n-1))%mod;
	}
	printf("%d\n",(ans+mod)%mod);
	return 0;
}

#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 20;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n;
ll s, f[N];
ll powmod(ll a, ll b)
{
	ll ans = 1;
	while(b)
	{
		if(b&1) ans = ans*a%mod;
		a = a*a%mod;
		b >>= 1;
	}
	return ans;
}
ll comp(ll a,ll b)
{
	if(a<b) return 0;
	if(a==b) return 1;
	if(b>a-b) b = a - b;
	ll ca = 1, cb = 1;
	for(int i=0;i<b;i++)
	{
		ca = ca*(a-i)%mod;
		cb = cb*(b-i)%mod;
	}
	return ca*powmod(cb,mod-2)%mod;
}
ll lucas(ll n, ll m)
{
	if(!m) return 1;
	return comp(n%mod, m%mod)*lucas(n/mod, m/mod)%mod;
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> s;
 	for(int i=0; i<n; i++) cin >> f[i];
 	ll ans = 0;
 	for(int i=0; i<(1<<n); i++)
 	{
 		int parity = 0;
 		ll d = n - 1 + s;
 		for(int j=0; j<n; j++)
 		{
 			if((i>>j)&1)
 			{
 				parity++;
 				d -= f[j];
 			}
 		}
 		//debug(d-parity); debug(n-1);
 		ll cur = lucas(d-parity, n-1);
 		//debug(cur);
		if(parity&1) ans = (ans - cur + mod)%mod;
		else ans = (ans + cur)%mod;
	}
	ans = (ans + mod)%mod;
	cout << ans;
	return 0;
}

#include<bits/stdc++.h>
#define re register
#define mod 1000000007
using namespace std;
long long n,s,a[30],ans;
long long mul[30];
inline int read()
{
    int k=1;
    int sum=0;
    char c=getchar();
    for(;'0'>c || c>'9';c=getchar())
        if(c == '-') k = -1;
    for(; '0' <= c && c <= '9'; c = getchar())
        sum = sum * 10 + c - '0';
    return sum * k;
}
inline void out(long long x)
{
    if(x < 0) { putchar('-'); x *= -1; }
    if(x > 9) out(x / 10);
    putchar(x % 10 + '0');
}
inline long long fast_power(long long a,long long k)
{
	long long base=a,anss=1;
	while(k)
	{
		if(k&1) anss=anss*base%mod;
		base=base*base%mod;
		k/=2;
	}
	return anss;
}
inline int C(long long x,int y)
{
	if(x<0 || y<0 || x<y) return 0;
	x%=mod;
	if(x==0 || y==0) return 1;
	long long c=1;
	for(re int i=0;i<y;i++) c=c*(x-i)%mod;
	for(re int i=1;i<=y;i++) c=c*mul[i]%mod;
	return c;
}
int main()
{
	n=read();s=read();
	for(re int i=1;i<=n;i++) a[i]=read();
	for(re int i=1;i<=20;i++)
	{
		mul[i]=fast_power(i,mod-2);
	}
	for(re int i=0;i<1<<n;i++)
	{
		if(i==0) ans=(ans+C(n+s-1,n-1))%mod;
		else
		{
			long long t=n+s;int p=0;
			for(re int j=0;j<n;j++)
			if(i>>j&1)
			{
				p++;
				t-=a[j+1];
			}
			t-=p+1;
			if(p&1)
			{
				ans=(ans-C(t,n-1))%mod;
			}
			else
			{
				ans=(ans+C(t,n-1))%mod;
			}
		}
	}
	out((ans+mod)%mod);
	return 0;
}

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>

#define llong long long

using namespace std;

const int INF = (int) 1e9 + 7;
const int MXN = (int) 1e4 + 7;

int n;
llong s;
llong rev[MXN], f[MXN];

llong binpow(llong x, int y) {
    llong res = 1;
    while (y) {
        if (y & 1)
            res = (res * x) % INF;

        y >>= 1;
        x = (x * x) % INF;
    }
    return res;
}

llong c(llong x, llong y) {
    if (y > x)
        return 0;

    llong res = 1;
    for (llong i = x - y + 1; i <= x; i++)
        res = (res * i) % INF;

    res = (res * rev[y]) % INF;
    return res;
}

int main() {
    ios_base::sync_with_stdio(0);

    cin >> n >> s;

    s = s + n;
    for (int i = 0; i < n; i++) {
        cin >> f[i];
        f[i]++;
    }

    llong cur = 1;
    rev[0] = rev[1] = 1;
    for (int i = 2; i <= n; i++) {
        cur = cur * (llong) i;
        rev[i] = binpow(cur, INF - 2);
    }
    llong ans = 0;
    for (int m = 0; m < (1 << n); m++) {
        llong csum = 0, bitlen = 0;
        for (int i = 0; i < n; i++) {
            if (m & (1 << i)) {
                bitlen++;
                csum += f[i];
            }
        }
        csum = s - csum;
        if (bitlen & 1) ans -= c(csum - 1, n - 1);
        else ans += c(csum - 1, n - 1);
        ans = (ans % INF + INF) % INF;
    }
    cout << ans;
    return 0;
}

#include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<stack>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<map>
#define PI acos(-1)
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;
const int maxn=1e3+5;
const int MOD=1e9+7;
LL n,m;
LL a[maxn];
LL extgcd(LL a,LL b,LL& x,LL& y)
{
   LL d;
   if(b==0)
   {
      d=a;
      x=1;
      y=0;
   }
   else
   {
      d=extgcd(b,a%b,y,x);
      y=y-(a/b)*x;
   }
   return d;
}
LL findv(LL a,LL m)
{
   LL x,y;
   LL d=extgcd(a,m,x,y);
   x=(x%m+m)%m;
   return x;
}
LL C(LL n,LL m)
{
   if(n<0||m<0||n<m)
      return 0;
   if(n==0||m==0)
      return 1;
   LL sum=1;
   LL spm=1;
   for(LL i=n;i>=n-m+1;i--)
   {
      sum=((sum%MOD)*(i%MOD))%MOD;
   }
   for(LL i=m;i>=1;i--)
   {
      spm=((spm%MOD)*(i%MOD))%MOD;
   }
   return (sum*findv(spm,MOD))%MOD;
}
void solve()
{
   LL sum=0;
   for(int i=0;i<(1<<n);i++)
   {
      LL cnt=0;
      LL tem=n+m;
      for(int j=0;j<n;j++)
      {
         if(i&(1<<j))
         {
            cnt++;
            tem=(tem-a[j])%MOD;
         }
      }
      tem-=cnt+1;
      tem%=MOD;
      //cout << tem << ' ' << n-1 << endl;
      if(cnt&1)
      {
         sum=(sum-C(tem,n-1))%MOD;
      }
      else
      {
         sum=(sum+C(tem,n-1))%MOD;
      }
   }
   cout << sum << endl;
}

int main()
{
   cin>>n>>m;
   for(int i=0;i<n;i++)
      cin>>a[i];
   solve();
   return 0;
}

#include <iostream>
#include <vector>

#define MOD 1000000007

using namespace std;

typedef long long ll;

ll hor;

ll bigMod(ll base, ll pw)
{
    if(!pw)
        return 1LL;
    ll x = bigMod(base,pw>>1);
    x = (x*x)%MOD;
    if(pw&1)
        x = (x*base)%MOD;
    return x;
}

ll comb(ll n, ll r)
{
    if(n < r)
        return 0;
    ll ret = n%MOD;
    for(ll i=n-1; i>(n-r); i--)
    {
        ret = (ret*(i%MOD))%MOD;
    }
    return (ret*hor)%MOD;
}

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

	int n;
	ll s;
	cin >> n >> s;
	vector<ll> f(n);
	for(int i=0; i<n; i++)
    {
        cin >> f[i];
    }
    hor = 1;
    for(int i=1; i<n; i++)
    {
        hor = (hor*i)%MOD;
    }
    hor = bigMod(hor,MOD-2)%MOD;
    int limit = (1<<n);
    ll ways = 0;
    for(int mask=0; mask<limit; mask++)
    {
        int setbit = 0;
        ll sum = 0;
        for(int i=0; i<n; i++)
        {
            if(mask&(1<<i))
            {
                sum += f[i]+1;
                setbit++;
            }
        }
        if(sum <= s)
        {
            if(setbit&1)
                ways = (ways - comb(n+(s-sum)-1,n-1) + MOD)%MOD;
            else
                ways = (ways + comb(n+(s-sum)-1,n-1))%MOD;
        }
    }

    cout << ways << endl;

	return 0;
}

#include <cstdio>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
using namespace std;
template <typename kdl> inline void read(kdl &x){
	x = 0;int f = 1;char c = getchar();
	for(;c < '0' || '9' < c; c = getchar()) if(c == '-') f = -1;
	for(;'0' <= c && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;return;
}
template <typename kdl> inline void print(kdl x){
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + 48);
	return;
}
#define rg register
#define ll long long
#define r_2(a,b) read(a),read(b)
#define r_3(a,b,c) read(a),read(b),read(c)
#define print_n(a) print(a),puts("")
#define print_(a) print(a),putchar(' ')
const ll mod = 1000000007;
const ll maxn = 24;
ll mul(ll a,ll b){
	a %= mod;b %= mod;
	ll Ans = 0;
	while(b)
	{
		if(b & 1) Ans = (Ans + a) % mod;
		a = (a << 1) % mod;
		b >>= 1;
	}
	return Ans;
}
ll Pow(ll a,ll b){
	a %= mod;
	ll Ans = 1;
	while(b)
	{
		if(b & 1) Ans = mul(Ans , a);
		a = mul(a , a);
		b >>= 1;
	}
	return Ans;
}
ll jc(ll k){
	ll Ans = 1;
	for(rg ll i = 2;i <= k; i++) Ans *= i;
	return Ans;
}
ll n,lit,a[maxn];
ll s,ans;
ll f[maxn],inv[maxn];
ll C(ll a,ll b){
	if(a > b) return 0;
	if(a == b) return 1;
	ll Ans = inv[a];
	ll l = b - a + 1 , r = b;
	for(rg ll i = l;i <= r; i++) Ans = mul(Ans , i);
	return Ans;
}
int main()
{
	r_2(n , s);inv[n] = Pow(jc(n) , mod - 2);
	for(rg ll i = n - 1;i >= 0; i--) inv[i] = mul(inv[i + 1] , i + 1);
	lit = 1 << n;
	for(rg ll i = 1;i <= n; i++) read(f[i]);
	ans = C(n - 1 , n + s - 1);
	for(rg ll i = 1;i < lit; i++){
		ll w = 0;
		ll cnt = 0 , tot = 1;
		ll k = i;
		while(k)
		{
			if(k & 1) a[++cnt] = f[tot];
			tot++;
			k >>= 1;
		}
		for(rg ll j = 1;j <= cnt; j++) w = (w + a[j]); //% mod;
		if(cnt & 1) ans = (ans - C(n - 1 , n + s - w - cnt - 1)) % mod;
		else ans = (ans + C(n - 1 , n + s - w - cnt - 1)) % mod;
	}
	print_n(ans);
	return 0;
}

#include<bits/stdc++.h>
#define fre(x) freopen(#x".in","r",stdin), freopen(#x".out","w",stdout)
using namespace std;
typedef long long ll;
int p=1000000007;
int n;
ll S,f[21],inv[21],ans;
ll C(ll n,ll m){
    if(m>n)return 0;
    if(m>n-m)m=n-m;
    ll ans=1;
    for(ll i=n-m+1;i<=n;++i)ans=ans*i%p;
    return ans*inv[m]%p;
}
ll Lucas(ll n,ll m){
    if(!m)return 1;
    return C(n%p,m%p)*Lucas(n/p,m/p)%p;
}
int main(){
    //fre(devu);
    cin>>n>>S;
    inv[0]=inv[1]=1;
    for(int i=2;i<=n;++i)inv[i]=(p-p/i)*inv[p%i]%p;
    for(int i=2;i<=n;++i)inv[i]=inv[i]*inv[i-1]%p;
    for(int i=0;i<n;++i)cin>>f[i];
    for(int i=0;i<(1<<n);++i){
        int t=0;ll s=0;
        for(int j=0;j<n;++j)
            if(i>>j&1){
                ++t;
                s+=f[j]+1;
                if(s>S)continue;
            }
        ans=(ans+(t&1?-1:1)*Lucas(n+S-s-1,n-1)+p)%p;
    }
    cout<<ans;
}

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;

long long f[22];

int pmod(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = 1ll * res * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return res;
}

int nCk(long long n, long long k) {
  assert(n >= k);
  int res = 1;
  for (int i = 1; i <= k; ++i)
    res = 1ll * res * (n - i + 1) % MOD * pmod(i, MOD - 2) % MOD;
  return res;
}

int main() {
  //assert(freopen("input.txt", "r", stdin));
  //assert(freopen("output.txt", "w", stdout));
  //std::ios::sync_with_stdio(0);
  //std::cin.tie(0);
  int n;
  long long s;
  std::cin >> n >> s;
  for (int i = 0; i < n; ++i) std::cin >> f[i];
  long long ans = 0;
  for (int mask = 0; mask < 1 << n; ++mask) {
    int count = 0;
    for (int t = mask; t; t &= t - 1) ++count;
    long long sum = s;
    for (int i = 0; i < n; ++i)
      if (mask & (1 << i))
        sum -= f[i] + 1;
    if (sum < 0) continue;
    int val = nCk(sum + n - 1, n - 1);
    //std::cerr << "sum = " << sum << " n = " << count << " res = " << val << '\n';
    if ((count & 1) == 0) {
      ans = (ans + val) % MOD;
    } else {
      ans = (ans - val) % MOD;
    }
  }
  std::cout << ((ans % MOD) + MOD) % MOD;
}

#include<cstdio>
#include<cstdlib>
#define MOD 1000000007
#define LL long long

int n,fac_inv[25];
LL s,ans=0,f[25];

inline int power(int x,int y)
{
	int ret=1;
	for(;y;y>>=1,x=(LL)x*x%MOD)
	if(y&1)ret=(LL)ret*x%MOD;
	return ret;
}
inline void get(LL x,int z)
{
	if(x>s)return;
	LL rest=s-x,tot=1;
	for(LL i=n+rest-1;i>rest;i--)tot=tot*(i%MOD)%MOD;
	for(int i=1;i<=n-1;i++)tot=tot*fac_inv[i]%MOD;
	if(n&1)z=-z;
	ans=(ans+tot*z)%MOD;
}
void solve(int x,LL y,int z)
{
	if(x==(n+1))
	{
		get(y,z);return;
	}
	solve(x+1,y+f[x]+1,z);
	solve(x+1,y,-z);
}
int main()
{
	scanf("%d%I64d",&n,&s);
	for(int i=1;i<=n;i++)scanf("%I64d",&f[i]);

	LL tot=1;
	for(int i=1;i<=n;i++)tot=tot*i%MOD;
	fac_inv[n]=power(tot,MOD-2);
	for(int i=n-1;i+1;i--)fac_inv[i]=((LL)fac_inv[i+1]*(i+1))%MOD;

	solve(1,0,1);
	printf("%d\n",(ans+MOD)%MOD);
	return 0;
}

#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>

using namespace std;

#define ll long long
#define mod 1000000007

const int N = 25;

int n;
ll s;
ll f[N];
ll ans;
int inv[N];

bool one(int mask, int pos){
	return (mask & (1 << pos));
}

int C(ll n, int k){
	int res = 1;
	for(ll i = n - k + 1;i <= n;++ i)
		res = (res * 1ll * i) % mod;
	res = (res * 1ll * inv[k]) % mod;
	return res;
}

int bin_pow(int a, int b){
	int res = 1;
	while(b){
		if(b & 1)
			res = (res * 1ll * a) % mod;
		a = (a * 1ll * a) % mod;
		b >>= 1;
	}
	return res;
}

int calc(int mask, int k){
	ll sum = s;
	for(int i = 0;i < n;++ i)
		if(one(mask, i))
			sum -= f[i] + 1;
	if(sum < 0)
		return 0;
	return C(sum + n - 1, n - 1);
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen ("in","r",stdin);
	freopen ("out","w",stdout);
	#endif
	scanf("%d%I64d", &n, &s);
	int fc;
	fc = inv[0] = 1;
	for(int i = 1;i <= n;++ i){
		fc = (fc * 1ll * i) % mod;
		inv[i] = bin_pow(fc, mod - 2);
	}
	for(int i = 0;i < n;++ i)
		scanf("%I64d", &f[i]);
	for(int mask = 0;mask < (1 << n);++ mask){
		int cnt = __builtin_popcount(mask);
		if(cnt & 1)
			ans = (ans - calc(mask, cnt) + mod) % mod;
		else
			ans = (ans + calc(mask, cnt)) % mod;
	}
	printf("%I64d\n", ans);
	return 0;
}

#include<cstdio>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll n,s,a[30];
ll fac[30],inv[30];
ll ksm(ll x,ll y)
{
  ll ans=1;
  while(y)
  {
  	if(y&1)  ans=ans*x%mod;
  	x=x*x%mod,y>>=1;
  }
  return ans;
}
ll c(ll m,ll n)
{
  if(n>m||m<=0)  return 0;
  if(n==m||n==0)  return 1;
  ll ans=inv[n];
  for(ll i=0;i<n;i++)
    ans=ans*(m-i)%mod;
  return ans;
}
int main()
{
  scanf("%lld%lld",&n,&s);
  for(int i=1;i<=n;i++)
    scanf("%lld",&a[i]);
  fac[1]=1;
  for(int i=2;i<=n;i++)
    fac[i]=fac[i-1]*i%mod;
  inv[n]=ksm(fac[n],mod-2);
  for(int i=n-1;i>=1;i--)
    inv[i]=inv[i+1]*(i+1)%mod;
  ll ans=0;
  for(ll i=0;i<(1<<n);i++)
  {
  	ll cnt=1,f=1,t=s;
  	for(int j=i,tot=1;j;j>>=1,tot++)
  	  if(j&1)
		cnt++,f=-f,t-=a[tot];
	ans=(ans+f*c(t+n-cnt,n-1)+mod)%mod;
  }
  printf("%lld",ans);
  return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define mod 1000000007
typedef long long ll;
ll a[22];
ll s;
int n;

ll pow_ni(ll n,ll x)
{
    ll ans=1;
    ll temp=x;
    int j=0;

    while(n)
    {
        if((1<<j)&n)
        {
            ans=ans*temp%mod;
            n-=1<<j;
        }
        j++;
        temp=temp*temp%mod;
    }
    return ans;
}

ll jisuan(ll n,int k)
{
    if(n<k)return 0;
    ll x=1,y=1;
    ll i;
    for(i=n;i>=n-k+1;i--)x=(x*(i%mod))%mod;
    for(i=k;i>=1;i--)y=y*i%mod;
    return x*pow_ni(mod-2,y)%mod;
}

int main()
{
    while(cin>>n>>s)
    {
        int i,j;
        int ss;
        ll sum=0;
        for(i=0;i<n;i++){
                cin>>a[i];
        sum+=a[i];
        }
        if(sum<s||s==0)cout<<0<<endl;
        else {
        ll ans=0;

        for(ss=0;ss<(1<<n);ss++)
        {
            sum=0;
            int ok=0;
            for(j=0;j<n;j++)if((1<<j)&ss){
                    sum+=a[j]+1;
                    ok++;
            }
            if(sum<s+n-1){
                if(ok%2==0)ans=(ans+jisuan(s+n-1-sum,n-1))%mod;
                else ans=(ans+mod-jisuan(s+n-1-sum,n-1))%mod;
            }

        }
        cout<<ans<<endl;
        }
    }
    return 0;
}

#include <algorithm>
#include <iostream>
#include <utility>
#include <cstdio>
#include <cctype>
#define lowbit(x) ((x)&-(x))
#define int long long
using namespace std;
const int MOD=1e9+7;
const int MAXN=25;
int n,s,dat[MAXN],inv[MAXN],ans;
inline int read()
{
	int x=0;char ch=getchar();
	while(!isdigit(ch)) ch=getchar();
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x;
}
inline pair<int,int> calc(int x)
{
	int sum=0,ans=0;
	for(int i=1;i<=n;i++)
		if(x&(1<<(i-1)))
			sum++,ans+=dat[i];
	return make_pair(sum,ans);
}
inline int qpow(int x,int y)
{
	int r=1,k=x%MOD;
	for(;y;y>>=1)
	{
		if(y&1) r*=k,r%=MOD;
		k*=k,k%=MOD;
	}
	return r;
}
inline int C(int x)
{
	if(x<0) return 0;
	int r=1;
	for(int i=1;i<=n-1;i++)
		r=r*inv[i]%MOD*(i+x)%MOD;
	return r;
}
signed main()
{
	n=read(),s=read();
	for(int i=1;i<=n;i++)
		dat[i]=read();
	for(int i=1;i<=n+1;i++)
		inv[i]=qpow(i,MOD-2);
	for(int i=0;i<(1<<n);i++)
	{
		auto x=calc(i);
		if(x.first&1) ans-=C(s-x.second-x.first);
		else ans+=C(s-x.second-x.first);
		ans+=MOD,ans%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define LOG(x) #x << ": " << x

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ld PI = 3.141592653589793;
const ll MOD = 1e9 + 7, INF = 1e9 + 10;
const int N = 20 + 10;

ull f[N], a[N];

ull c(ull n, ull k)
{
	if (k > n)
		return 0;
	if (!n)
		return (k ? 0 : 1);
	if (!k)
		return 1;
	for (ull i = 2; i <= k; i++)
		a[i] = i;
	ull ret = 1;
	for (ull i = n; i > n - k; i--)
	{
		ull tmp = i, g;
		for (ull j = 2; j <= k; j++)
		{
			g = __gcd(i, a[j]);
			tmp /= g;
			a[j] /= g;
		}
		tmp %= MOD;
		ret *= tmp;
		ret %= MOD;
	}
	return ret;
}

int main()
{
	ull n, s, ans = 0;
	cin >> n >> s;
	for (ull i = 0; i < n; i++)
		cin >> f[i];
	for (int st = 0; st < (1 << n); st++)
	{
		int cnt = 0, tmp = st, cur = n - 1;
		ull sub = 0;
		while (tmp)
		{
			if ((tmp & 1) == 1)
			{
				cnt++;
				sub += f[cur] + 1;
			}
			cur--;
			tmp >>= 1;
		}
		if (sub <= s)
		{
			if (cnt % 2 == 0)
				ans += c(s - sub + n - 1, n - 1);
			else
				ans -= c(s - sub + n - 1, n - 1);
			ans += MOD;
			ans %= MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define LL long long

using namespace std;
const LL MOD = 1e9 + 7;
LL A[25], inv[25], ans, m;
int n;

LL qpow(LL a, LL b) {
    LL ret = 1;
    while (b) {
        if (b) ret = ret * a % MOD;
        a = a * a % MOD, b >>= 1;
    }
    return ret;
}

LL C(LL b, LL a) {
    if (a < 0 || b < 0 || a > b) return 0;
    if (!(b%MOD) || !a) return 1;
    LL ret = 1;
    for (int i = 0; i < a; i++) ret = ret * (b - i) % MOD;
    for (int i = 1; i <= a; i++) ret = ret * inv[i] % MOD;
    return ret;
}

int main() {
    // freopen("testdata.in", "r", stdin);
    // freopen("testdata.out", "w", stdout);
    for (int i = 1; i <= 20; i++) inv[i] = qpow(i, MOD - 2);
    scanf("%d%lld", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%lld", &A[i]);
    ans = C(n + m - 1, n - 1);
    for (int S = 1; S < (1 << n); S++) {
        LL tmp = n + m; int cnt = 0;
        for (int i = 0; i < n; i++) if (S & (1 << i))
            cnt++, tmp -= A[i + 1];
        tmp -= cnt + 1;
        if (cnt & 1) ans = (ans - C(tmp, n - 1) + MOD) % MOD;
        else ans = (ans + C(tmp, n - 1)) % MOD;
    }
    printf("%lld\n", ans);
    return 0;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 50000;
map < int, int > t;
const int mod = 1e9 + 7;
int a[N];
int f(int x){
    if (x == 0) return 1;
    return f(x - 1) * x % mod;
}
int binpow(int x, int y){
    int res = 1;
    while(y){
        if (y % 2) res = res * x % mod;
        x = x * x % mod;
        y /= 2;
    }
    return res;
}
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, s;
    cin >> n >> s;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        a[i]++;
    }
    int zz = binpow(f(n - 1), mod - 2);
    for (int j = 0; j < (1LL << n); j++){
        int x = 0;
        int y = 0;
        for (int i = 0; i < n; i++){
            if (j & (1LL << i)) x += a[i + 1]; else y++;
        }
        if (y % 2) t[x]--; else t[x]++;
    }
    int ans = 0;
    for (auto i: t){
        if (i.F - n < s) continue;
        int x = i.F - n - s + 1;
        x %= mod;
        int y = x;
        for (int j = 1; j < n - 1; j++)
            y = y * (x + j) % mod;
        y = y * zz % mod;
        ans = (ans + i.S * y % mod + mod) % mod;
    }
    cout << ans;
}

#include <cstdio>
#include <functional>
#include <algorithm>

using namespace std;

const long long mod = 1000000007;

long long dat[22];

pair<long long, long long> extended_gcd(long long a, long long b) {
	if (b == 0) return make_pair(1, 0);
	pair<long long, long long> t = extended_gcd(b, a % b);
	return make_pair(t.second, t.first - t.second * (a / b));
}

long long modinverse(long long a, long long m) {
	return (extended_gcd(a, m).first % m + m) % m;
}

long long comb(long long a, long long b){
	if (b < 0 || b > a) return 0;
	b = a-b;
	long long res = 1;
	for(long long i = a-b+1; i <= a; i++) {
		res = (res * i) % mod;
	}
	for(long long i = 1; i <= b; i++) {
		res = (res * modinverse(i,mod)) % mod;
	}
	return res;
}

int main(){
	int n;
	long long s;
	scanf("%d%lld",&n,&s);
	for(int i = 0; i < n; i++) {
		scanf("%lld",&dat[i]);
	}
	long long ans = 0;
	for(int i = 0; i < (1<<n); i++){
		int cnt = 0;
		long long sum = 0;
		for(int j = 0; j < n; j++) {
			if ( i & ( 1<< j)){
				cnt++;
				sum += dat[j];
			}
		}
		if (cnt%2) {
			long long v = s-sum-1;
			ans -= comb((n - 1) + v, v);
		} else {
			long long v = s-sum-1 + (cnt==0);
			ans += comb((n - 1) + v, v);
		}
	}

	ans %= mod;
	ans += mod;
	ans %= mod;
	printf("%lld\n", ans);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

long long MOD = 1e9 + 7;
long long f[22],inv[22];

long long mul_inv(long long a, long long b){
	long long b0 = b, t, q;
	long long x0 = 0, x1 = 1;
	if (b == 1) return 1;
	while (a > 1) {
		q = a / b;
		t = b, b = a % b, a = t;
		t = x0, x0 = x1 - q * x0, x1 = t;
	}
	if (x1 < 0) x1 += b0;
	return x1;
}

long long cnp(long long n,long long k){
	long long res = 1;
	while(k){
		res = (n * res) % MOD;
		res = (inv[k] * res) % MOD;
		--n;--k;
	}
	return res;
}

long long inverse(long long a){
	return a==1?1:(long long)(MOD-MOD/a)*inverse(MOD%a)%MOD;
}

int main(){
  std::ios::sync_with_stdio(false);
  #ifndef ONLINE_JUDGE
  freopen("in.txt","r",stdin);
  #endif

	long long n,s;
	cin >> n >> s;

	for(int i=1;i<=n;++i){
		inv[i] = inverse(i);//mul_inv(i,MOD);
		cin >> f[i-1];
	}

	long long res = 0;
	for(int i=0;i<(1<<n);++i){
		long long tmp=0;
		int c = 0;
		for(int j=0;j<n;++j){
			if(i & (1 << j)){
				tmp += (f[j] + 1);
				c = !c;
			}
		}
		long long tmp2 = s - tmp;
		if(tmp2 >= 0){
			if(c == 0)	res = (res + cnp(n-1+tmp2,n-1)) % MOD;
			else res = ((res - cnp(n-1+tmp2,n-1)) % MOD + MOD ) % MOD;
		}
	}

	cout << res << endl;

  return 0;
}

#include<iostream>
#include<cstdio>
#include<set>
#define FIT(a,b) for(vector<int>::iterator it=b.begin();it!=b.end();it++)
#include<stack>
#define ROF(a,b,c) for(register int a=b;a>=c;--a)
#include<vector>
#include<algorithm>
#define FOR(a,b,c) for(register int a=b;a<=c;++a)
#include<cstring>
#include<bitset>
#include<cmath>
#include<iomanip>
#include<queue>
#define debug cerr<<"OK";
#define f cin
#define g cout
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ll long long
#define mod 1000000009
#define inf (1<<30)
#define NB 540
#define N 21
#define DIM 1100100
using namespace std;
/*ifstream f("a.in");
ofstream g("a.out");*/
/*int dx[]={0,0,0,1,-1};
int dy[]={0,1,-1,0,0};*/
ll sol,s,a[N],P[N],I[N];
int lim,n;
ll put(ll a,int p)
{
	ll sol=1;
	while(p)
	{
		if(p&1)
			sol=sol*a%mod;
		p>>=1;
		a=a*a%mod;
	}
	return sol;
}
int C(ll S,int n)
{
	if(S<n)
		return 0;
	ll val=1;
	S%=mod;
	FOR(i,1,n)
	{
		val=val*S%mod;
		S--;
		if(S<0)
			S=mod-1;
	}
	val=val*I[n]%mod;
	return (int)val;
}
int main ()
{
    #ifndef ONLINE_JUDGE
    freopen("a.in","r",stdin);
    freopen("a.out","w",stdout);
    #endif

	f>>n>>s;
	FOR(i,1,n)
	f>>a[i];
	lim=(1<<n);
	P[0]=1;
	FOR(i,1,20)
	P[i]=P[i-1]*i%mod;

	I[20]=put(P[20],mod-2);
	ROF(i,19,0)
	I[i]=I[i+1]*(i+1)%mod;
	lim--;
	FOR(i,0,lim)
	{
		int x=i;
		int p=1;
		long long sc=s;
		int nrb=0;
		while(x)
		{
			if(x&1)
			{
				sc-=a[p]+1;
				nrb++;
			}
			p++;
			x>>=1;
		}
		if(sc<0)
			continue;
		if(nrb&1)
			sol-=C(sc+n-1,n-1);
		else
			sol+=C(sc+n-1,n-1);
		if(sol<0)
			sol+=mod;
		if(sol>=mod)
			sol-=mod;
	}
	g<<sol;
    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;

#define int ll

const int maxN = 20 + 5;
const int MOD = 1e9 + 7;
int fac[maxN];

int pow(int a , int b)
{
    int ret = 1;
    if (b == 0)
        return 1;

    ret = pow(a , b / 2);
    if (b % 2)
        return ( ((ret * ret) % MOD) * a ) % MOD;
    else
        return (ret * ret) % MOD;
}

int choose(int n, int r)
{
    ll ret = 1;
    for (int i = n ; i >= n - r + 1 ; i--)
        ret *= i, ret %= MOD;

    ret *= pow(fac[r], MOD - 2);
    ret %= MOD;
    return ret;
}

int b[maxN];

int32_t main()
{
    fac[0] = 1;
    for (int i = 1 ; i < maxN ; i++)
        fac[i] = (fac[i - 1] * i) % MOD;

    int n;
    ll s;
    cin >> n >> s;
    for (int i = 0 ; i < n ; i++)
    {
        cin >> b[i];
        b[i] %= MOD;
    }

    //a[1] + a[2] + ... + a[n] = s
    int res = 0;
    for (int mask = 0 ; mask < (1 << n) ; mask++)
    {
        ll x = s;
        for (int i = 0 ; i < n ; i++)
            if ((mask >> i) & 1) //a[i] > b[i]
                x -= (b[i] + 1);

        if (x < 0)
            continue;
        int ans = choose(n + x - 1, n - 1);

        //cout << "Choosing " << n + x - 1 << " " << n - 1 << " = " << ans << endl;

        if (__builtin_popcount(mask) % 2 == 0)
        {
            //cout << "Adding " << endl;
            res += ans;
        }
        else
            res -= ans;

        res += MOD;
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll n,s,ans;
ll inv[30];
ll f[30];
ll ksm(ll x,ll y)
{
	ll re=1;
	while(y)
	{
		if(y&1)
		{
			re=re*x%mod;
		}
		x=x*x%mod;
		y>>=1;
	}
	return re;
}
ll C(ll x,ll y)
{
	ll re=1;
	int i,j;
	if(x<0||y<0||x<y) return 0;
	x%=mod;
	if(y==0) return 1;
	for(i=0;i<y;i++)
	{
		re=re*(x-i)%mod;
	}
	for(i=1;i<=y;i++)
	{
		re=re*inv[i]%mod;
	}
	return re;
}
int main()
{
	int i,j,x;
	for(i=1;i<=21;i++){inv[i]=ksm(i,mod-2)%mod;}
	scanf("%lld%lld",&n,&s);
	for(i=1;i<=n;i++){scanf("%lld",&f[i]);}
	for(x=0;x<(1<<n);x++)
	{
		ll p=0;
		ll sum=n+s;
		for(i=0;i<=n;i++)
		{
			if(x&(1<<i))
			{
				p++;
				sum-=f[i+1];
			}
		}
		sum-=(p+1);
		if(p&1)
		ans=ans-C(sum,n-1)%mod;
		else
		ans=ans+C(sum,n-1)%mod;
	}
	printf("%lld\n",ans);
	return 0;

}

#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, long long m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N=1e6+5;
const int MOD=1e9+7;

int n, s;
int a[N], fact[N], invfact[N];

int modinv(int k)
{
    return pow(k, MOD-2, MOD);
}

void precompute()
{
    fact[0]=fact[1]=1;
    for(int i=2;i<N;i++)
    {
        fact[i]=fact[i-1]*i;
        fact[i]%=MOD;
    }
    invfact[N-1]=modinv(fact[N-1]);
    for(int i=N-2;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=MOD;
    }
}

int nCr(int n, int r) //Difference between n and r is small
{
	if(n<0 || r>n)
		return 0;
	int ans=1;
	for(int i=n;i>=n-r+1;i--)
	{
		ans*=i;
		ans%=MOD;
	}
	ans*=invfact[r];
	ans%=MOD;
	return ans;
}

int32_t main()
{
	IOS;
	precompute();
	cin>>n>>s;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int ans=0;
	for(int i=0;i<(1LL<<n);i++)
	{
		int ct=0;
		int sum=s;
		for(int j=0;j<n;j++)
		{
			if(i&(1LL<<j))
			{
				ct++;
				sum-=(a[j+1]+1);
			}
		}
		int cur=nCr(sum+n-1, n-1);
		if(ct%2)
			ans=(ans-cur+MOD)%MOD;
		else
			ans=(ans+cur)%MOD;
	}
	cout<<ans;
	return 0;
}

#include<cstdio>
#include<cstdlib>
#define MOD 1000000007
#define LL long long

int n,fac_inv[25];
LL s,ans=0,f[25];

inline int power(int x,int y)
{
	int ret=1;
	for(;y;y>>=1,x=(LL)x*x%MOD)
	if(y&1)ret=(LL)ret*x%MOD;
	return ret;
}
inline void get(LL x,int z)
{
	if(x>s)return;
	LL rest=s-x,tot=1;
	for(LL i=n+rest-1;i>rest;i--)tot=tot*(i%MOD)%MOD;
	for(int i=1;i<=n-1;i++)tot=tot*fac_inv[i]%MOD;
	printf("tot ==%I64d\n",tot);
	if(n&1)z=-z;
	ans=(ans+tot*z)%MOD;
}
void solve(int x,LL y,int z)
{
	if(x==(n+1))
	{
		get(y,z);return;
	}
	solve(x+1,y+f[x]+1,z);
	solve(x+1,y,-z);
}
int main()
{
	scanf("%d%I64d",&n,&s);
	for(int i=1;i<=n;i++)scanf("%I64d",&f[i]);

	LL tot=1;
	for(int i=1;i<=n;i++)tot=tot*i%MOD;
	fac_inv[n]=power(tot,MOD-2);
	for(int i=n-1;i+1;i--)fac_inv[i]=((LL)fac_inv[i+1]*(i+1))%MOD;

	solve(1,0,1);
	printf("%d\n",(ans+MOD)%MOD);
	return 0;
}

#pragma GCC diagnostic error "-std=c++11"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll mod = 1e9+7;
const int maxn = 5e5 + 1000;

/* ******************************** */
/*  arithmetic operators in modular */
inline void add(int &a, int b)
{
    a += b;
    if (a >= mod)
        a -= mod;
}

inline void sub(ll &a, ll b)
{
    a -= b;
    if (a < 0)
        a += mod;
}

inline ll mul1(ll a, ll b)
{
    return (ll)((ull)a * b % mod);
}
inline ll mul2(ll a, ll b, ll x)
{
    ll ans = 0;
    while (b)
    {
        if (b & 1)
            ans = (ans + a) % x;
        b >>= 1, a = (a << 1) % x;
    }
    return ans;
}

inline ll mpow(ll a, ll p)
{
    ll res = 1;
    while (p)
    {
        if (p & 1)
            res = mul1(res, a);
        p >>= 1;
        a = mul1(a, a);
    }
    return res;
}

inline ll mpow(ll a, ll b, ll p)
{
    ll ans = 1 % p;
    while(b)
    {
        if(b&1) ans=ans*a%p;
        a=a*a%p;
        b>>=1;
    }
    return ans;
}

inline int inv(int a)
{
    a %= mod;
    if (a < 0)
        a += mod;
    int b = mod, u = 0, v = 1;
    while (a)
    {
        int t = b / a;
        b -= t * a;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    assert(b == 1);
    if (u < 0)
        u += mod;
    return u;
}
int inver[1000];
/* ********************************/

/* ********************************/
/*  something about prime  */
bool is_prime_by_try(int n)
//small range and time complexity isO(sqrt(N))
{
    if (n < 2)
        return false;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

inline bool test(int n, int a, int d)
{
    if (n == 2)
        return true;
    if (n == a)
        return true;
    if ((n & 1) == 0)
        return false;
    while (!(d & 1))
        d >>= 1;
    int t = mpow(a, d, n);
    while (d != n - 1 && t != n - 1 && t != 1)
    {
        t = (ll)t * t % n;
        d = d << 1;
    }
    return (t == n - 1 || (d & 1) == 1);
}

bool is_prime_by_random(ull n)
{
    if (n < 2)
        return false;
    int a[] = {2, 3, 61};
    for (int i = 0; i < 3; i++)
        if (!test(n, a[i], n - 1))
            return false;
    return true;
}
const int prime_maxn = 5e6 + 1000;
int isprime[prime_maxn];
void get_prime(int n)
//Eratosthenes method,O(N log (log N))
{
    fill(isprime, isprime + prime_maxn, 1);
    isprime[0] = 0, isprime[1] = 0;
    for (int i = 2; i <= n; i++)
    {
        if (!isprime[i])
            continue;
        //cout<<i<<endl;
        for (int j = i; j <= n / i; j++)
            isprime[i * j] = false;
    }
}

int primenum = 0, prime[prime_maxn], is_not_prime[prime_maxn];
void primes(int n)
{
    // linear method(O(N))
    memset(prime, 0, sizeof(prime_maxn));
    memset(is_not_prime, 0, sizeof(is_not_prime));
    primenum = 0;
    for (int i = 2; i <= n; i++)
    {
        if (!is_not_prime[i])
        {
            is_not_prime[i] = i, prime[++primenum] = i;
        }
        for (int j = 1; j <= primenum; j++)
        {
            if (prime[j] > is_not_prime[i] || prime[j] > n / i)
                break;
            is_not_prime[i * prime[j]] = prime[j];
        }
    }
    //for(int i=1;i<=primenum;i++) cout<<prime[i]<<endl;
}
/* ******************************* */

/* ******************************* */
// factorize

vector<pair<ll, int>> fac;
void divide(int n)
{
    fac.clear();
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            int div = 0;
            while (n % i == 0)
            {
                n /= i;
                div++;
            }
            fac.push_back(make_pair(i, div));
        }
    }
    if (n > 1)
        fac.push_back(make_pair(n, 1));
    // for(auto it:fac)
    // {
    //     cout<<it.first<<"^"<<it.second<<endl;
    // }
}

/* ******************************* */

/* ******************************* */
// get phi
ll phi(ll n)
{
    ll ans = n;
    for (ll i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ans = ans / i * (i - 1);
            while (n % i == 0)
                n /= i;
        }
    }
    if (n > 1)
        ans = ans / n * (n - 1);
    return ans;
}
// modified to get faster phi
ll phi_table1[maxn];
void Eratosthenes_way_to_get_phi(ll n)
{
    for (int i = 2; i <= n; i++)
        phi_table1[i] = i;
    for (int i = 2; i <= n; i++)
    {
        if (phi_table1[i] == i)
        {
            for (int j = i; j <= n; j += i)
            {
                phi_table1[j] = phi_table1[j] / i * (i - 1);
            }
        }
    }
}

/* ******************************* */
/*求解不定方程*/
inline ll gcd(ll a, ll b)
{
    return !b ? a : gcd(b, a % b);
}
inline ll exgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    int r = exgcd(b, a % b, y, x);
    y -= x * (a / b);
    return r;
}
/* ******************************* */

/* ******************************* */
/*求解同余不定方程组*/
//Chinese Remaining Theory
// ll a[maxn], m[maxn];
//equations like x%(m[i])==a[i]
// ll CRT(ll a[], ll m[], ll n)
// {
//     if (n == 1)
//     {
//         if (m[0] > a[0])
//             return a[0];
//         else
//             return -1;
//     }
//     LL x, y, d;
//     for (int i = 1; i < n; i++)
//     {
//         if (m[i] <= a[i])
//             return -1;
//         d = ex_gcd(m[0], m[i], x, y);
//         if ((a[i] - a[0]) % d != 0)
//             return -1; //不能整除则无解
//         LL t = m[i] / d;
//         x = ((a[i] - a[0]) / d * x % t + t) % t; //第0个与第i个模线性方程的特解
//         a[0] = x * m[0] + a[0];
//         m[0] = m[0] * m[i] / d;
//         a[0] = (a[0] % m[0] + m[0]) % m[0];
//     }
//     return a[0];
// }
/* ******************************* */

/* ******************************* */
//BSGS&&exBSGS&&primitive root
// solve equations like (a^x)%p==b

ll bsgs(ll a, ll b, ll p)
{
    map<ll,ll>tab;
    ll u=(ll) sqrt(p)+1;
    ll now=1,step;
    for(ll i=0;i<u;i++)
    {
        ll tmp=b*mpow(now,p-2,p)%p;
        if(!tab.count(tmp)) tab[tmp]=i;
        now=now*a%p;
    }
    step=now;
    now=1;
    for(ll i=0;i<p;i+=u)
    {
        if(tab.count(now)) return i+tab[now];
        now=now*step%p;
    }
    return -1;
}
/* ******************************* */

/* ******************************* */
// solve C(a,b)
namespace combination{
    int inv[maxn];
    ll C(ll n,ll m)
    {
        if(n<m) return 0;
        ll ans=1;
        for(int i=0;i<m;i++)
        ans=ans*(n-i)%mod*inv[i+1]%mod;
        return ans;
    }
    ll Lucas(ll n,ll m)
    {
        if(n<0) return 0;
        if(!m) return 1;
        return Lucas(n/mod,m/mod)*C(n%mod,m%mod)%mod;
    }
}
/* ******************************* */
ll n,s,f[100];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>s;
    for(int i=1;i<=n;i++)
    cin>>f[i];
    for(int i=1;i<=20;i++)
    combination::inv[i]=mpow(i,mod-2);
    ll ans=0;
    for(int x=0;x<(1<<n);x++)
    {
        // cout<<combination::Lucas(n+s-1,n-1)<<" "<<combination::Lucas(t,n-1)<<endl;
        if(x==0) ans=(ans+combination::Lucas(n+s-1,n-1))%mod;
        else
        {
            ll t=n+s;
            ll p=0;
            for(int i=0;i<n;i++)
            {
                if((x>>i)&1) p++,t-=f[i+1];
            }
            t-=p+1;
            cout<<n<<" "<<s<<" "<<t<<" "<<p<<" ";
            // cout<<combination::Lucas(n+s-1,n-1)<<" "<<combination::Lucas(t,n-1)<<endl;
            if(p&1) ans=(ans-combination::Lucas(t,n-1))%mod;
            else    ans=(ans+combination::Lucas(t,n-1))%mod;
        }
    }
    cout<<(ans+mod)%mod<<endl;
}

#include <bits/stdc++.h>
using namespace std;

const int N = 25, MOD = 1e9+7;

int n, inv[N];
long long f[N];

int mod(long long x){
    return ((x%MOD)+MOD)%MOD;
}

int power(int a, int x){
    if(x==0) return 1;
    if(x%2==1) return ((long long)a*power(a,x-1))%MOD;
    int half = power(a,x/2);
    return ((long long)half*half)%MOD;
}

int xCp(long long x, int p){
    if(x<p) return 0;
    int resp = 1;
    for(int i = 0; i < p; i++){
        resp = ((long long)resp*mod(x-i))%MOD;
        resp = ((long long)resp*inv[i+1])%MOD;
    }
    return resp;
}

int main(){
    long long s;

    scanf("%d %lld", &n, &s);
    for(int i = 0; i < n; i++){
        scanf("%lld", &f[i]);
    }
    for(int i = 1; i <= n; i++){
        inv[i] = power(i,MOD-2);
    }
    int ans = 0;
    for(int mask = 0; mask < (1<<n); mask++){
        int k = 0;
        for(int i = 0; i < n; i++){
            if(mask&(1<<i)) k += f[i]+1;
        }
        int e = xCp(s-k+n-1,n-1);
        if(__builtin_popcount(mask)%2==1) e = -e;
        ans = (ans+e)%MOD;
    }
    printf("%d\n", ans);

    return 0;
}

//by Letme Know
#include<bits/stdc++.h>//好东西666，下面那一堆去死吧
/*
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<queue>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<time.h>
*/
using namespace std;
const long long mod=1e9+7;
int n;
long long m,a[25],inv[25],jc,ans;
inline long long read(){
    long long x=0,f=1; char ch=getchar();
    while(!isdigit(ch)) { if(ch=='-') f=-1; ch=getchar(); }
    while(isdigit(ch)) { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
    return x*f;
}
inline long long ksm(long long a,long long b)
{
	long long ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
inline long long C(long long a,long long b)
{
	if(a<0||b<0||a>b) return 0;
	b%=mod;
	if(!a||!b) return 0;
	long long sum=1;
	for(long long i=b-a+1;i<=b;i++)
		sum=sum*i%mod;
	return sum*inv[a]%mod;
}
int main()
{
	scanf("%d",&n);
	jc=1;
	for(int i=1;i<=n;i++)
		jc=jc*i%mod,inv[i]=ksm(jc,mod-2);
	m=read();
	for(int i=1;i<=n;i++) a[i]=read();
	if(n==1&&m==1&&a[1]==1) {
		puts("1");
		return 0;
	}
	for(int i=0;i<(1<<n);i++)
	{
		long long t=n+m;
		int cnt=0;
		for(int j=1;j<=n;j++)
			if(i>>(j-1)&1) t-=a[j],cnt++;
		if(cnt&1) ans=(ans-C(n-1,t-cnt-1)+mod)%mod;
		else ans=(ans+C(n-1,t-cnt-1))%mod;
	}
	printf("%lld",ans);
    return 0;
}

#include <cstdio>
#include <numeric>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
#include <deque>
#include <cassert>

using namespace std;

#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define y0 y3487465
#define y1 y8687969
#define fill(x,y) memset(x,y,sizeof(x))
#define prev PREV
#define next NEXT
#define _bit(x,y) ((x >> y) & 1)
#define bin(x,y) (bitset<y>) x

typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef double D;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;

template<class T> T abs(T x) { re x > 0 ? x : -x; }

const long double pi = acos (-1.0);

#define filename ""

int n;
int m;

const ll mod = 1e9 + 7;

ll a[20];

ll inv (ll x)
{
	ll res = 1, mul = x;
	for (int i = 1; i <= mod - 2; i <<= 1) {
		if ((mod - 2) & i) res = (res * mul) % mod;
		mul = (mul * mul) % mod;
	}
	re res;
}

ll cnk(ll n, ll k)
{
	ll res = 1;
	if (n < k) re 0;
	for (int i = 0; i < k; i++) res = (res * (n - i) * inv (i + 1)) % mod;
	re res;
}

int main () {
//	freopen (filename".in", "r", stdin);
//	freopen (filename".out", "w", stdout);
	ll s;
	cin >> n >> s;
	for (int i = 0; i < n; i++) cin >> a[i];
	ll ans = cnk (s + n - 1, n - 1);
	for (int i = 1; i < (1 << n); i++) {
		int j = i, k = 0, f = 0;
		ll res = 0;
		while (j) {
			if (j & 1) { f ^= 1;  res += a[k] + 1; }
			k ++;
			j >>= 1;
		}
		res = cnk (s + n - res - 1, n - 1);
		if (f == 1) res = -res;
		ans += res;
	}
	cout << max (0ll, ans) << endl;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#define imax(a,b) ((a)>(b)?(a):(b))
#define imin(a,b) ((a)<(b)?(a):(b))
#define is(ch) (ch>='0'&&ch<='9')
#define LL long long

using namespace std;

inline void read(int &x)
{
	x = 0; char ch = getchar(); bool p = 0;
	for (; !is(ch); ch = getchar()) p |= ch == '-';
	for (; is(ch); ch = getchar())	x = (x << 3) + (x << 1) + (ch ^ 48);
	x = p ? -x : x;
}

inline void read(LL &x)
{
	x = 0; char ch = getchar(); bool p = 0;
	for (; !is(ch); ch = getchar()) p |= ch == '-';
	for (; is(ch); ch = getchar())	x = (x << 3) + (x << 1) + (ch ^ 48);
	x = p ? -x : x;
}

const int mods = 1e9 + 7;
const int N = 25;
LL d[N], inv[N];
int n, m;

LL fst(LL a, LL b, LL mods)
{
	LL ans = 1;
	for (; b; b >>= 1)
	{
		if (b & 1) ans = ans * a % mods;
		a = a * a % mods;
	}
	return ans;
}

void Prep()
{
	LL csum = 1;
	for (LL i = 1; i <= n; ++i)
		csum = csum * i % mods,
		inv[i] = fst(csum, mods - 2, mods);
}

LL C(LL c, LL b)
{
	if (c < 0 || c < 0 || c < b)	return 0;
	c %= mods;
	if (!c || !b) return 1;

	LL sum = 1;
	for (int i = 0; i < b; ++i)
		sum = sum * (c - i) % mods;

	return sum * inv[b] % mods;
}

LL Rc()
{
	LL kn = 1 << n, ans = 0;

	ans = C(n + m - 1, n - 1);

	for (LL i = 1; i < kn; ++i)
	{
		LL t = n + m;
		int p = 0;
		for (int j = 0; j < n; ++j)
			if (i >> j & 1)
			{
				++p;
				t -= d[j + 1];
			}
		t -= p + 1;
		ans += (p & 1 ? -1 : 1) * C(t, n - 1), ans %= mods;
	}
	return (ans + mods) % mods;
}

int main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	read(n), read(m);
	Prep();
	for (int i = 1; i <= n; ++i) read(d[i]);

	printf("%lld", Rc());

	return 0;
}

#include <iostream>
#include <cstdio>
using namespace std;
long long inv[21],a[21];
int n;
long long m;
const int mod=1000000007;
int power(int x,int y)
{
	int ans=1;
	while(y)
	{
		if(y%2==1) ans=(long long)ans*x%mod;
		x=(long long)x*x%mod;
		y=y/2;
	}
	return ans;
}

int C(long long y,int x)
{
	int ans=1;
	if(y<0||x<0||y<x) return 0;
	if(y==0||x==0) return 1;
	y%=mod;
	for(int i=0;i<x;i++) ans=(long long)ans*(y-i)%mod;
	for(int i=1;i<=x;i++) ans=(long long)ans*inv[i]%mod;
	return ans;
}

int main()
{
	int ans=0;
	for(int i=1;i<=20;i++) inv[i]=power(i,mod-2);
	cin>>n>>m;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int x=0;x< 1<<n;x++)
	{
		if(x==0) ans=(ans+C(n+m+1,n-1))%mod;
		else
		{
			long long t=n+m;
			int p=0;
			for(int i=0;i<n;i++)
				if(x>>i&1)
				{
					p++;
					t-=a[i+1];
				}
			t-=p+1;
			if(p&1) ans=(ans-C(t,n-1))%mod;
			else ans=(ans+C(t,n-1))%mod;
		}
	}
	cout<<(ans+mod)%mod<<endl;
	return 0;
}

#include <sstream>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <list>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <bits/stdc++.h>
using namespace std;

#define SZ(x) ((int)x.size())
#define mem(name,val) memset(name,(val),sizeof(name));
#define ll long long
#define SF scanf
#define PF printf
#define psb(b) push_back((b))
#define ppb() pop_back()
#define oo (1<<28)
#define mp make_pair
#define fs first
#define sc second
#define Read freopen("in.txt","r",stdin)
#define Write freopen("out.txt","w",stdout)
#define __ std::ios_base::sync_with_stdio (false)

///V^2*E Complexity
///number of augment path * (V+E)
///Base doesn't matter
int mod=1000000007;
ll inv[30];
ll fd[30];
//__builtin_popcount
int check(int mask,int pos)
{
    return (bool)(mask&(1<<pos));
}
ll bigmod(int n,int p,int mod)
{
    if(p==1)return n;
    if(p&1)
    {
        return (n*bigmod(n,p-1,mod))%mod;
    }
    ll f=bigmod(n,p/2,mod);
    return (f*f)%mod;
}
ll func(ll n,ll r)
{
   // if(n-r<r)r=n-r;
    ll v=(n-r)%mod;
    ll ret=1;
    if(r>20)while(1);
    for(ll i=v+1,j=1;j<=r;i++,j++)
    {
        if(i>=mod)i%=mod;
        ret*=i;
        if(ret>=mod)ret%=mod;
       // ret*=inv[j];
      //   if(ret>=mod)ret%=mod;
    }
    ret*=inv[r];
    return ret%mod;
}

int main()
{
    for(int i=1;i<=21;i++)
    {
        inv[i]=bigmod(i,mod-2,mod);
        if(i>1)inv[i]*=inv[i-1];
        inv[i]%=mod;

    }
    int n;
    ll S;
    scanf("%d%lld",&n,&S);
    for(int i=0;i<n;i++)scanf("%lld",&fd[i]);
    ll ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        ll ds=S;
        for(int j=0;j<n;j++)
        {
            if(!check(i,j))continue;
            ds-=(fd[j]+1);
        }
        // cout<<ds<<" "<<i<<" "<<endl;
        if(ds<0)continue;
       // cout<<i<<endl;
        ll gt=func(ds+n-1,n-1);
     //   cout<<i<<endl;
        if(__builtin_popcount(i)&1){
            ans-=gt;
            if(ans<0)ans=(ans+mod)%mod;
        }
        else ans+=gt;
    }
    cout<<(ans)%mod<<endl;

}

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
#define f first
#define s second

const int N = 20 + 10;
const ll mod = 1e9 + 7;
const ll inf = 1e16;

ll f[N];
vector<ll> b[N];
ll m;

ll C(ll a, ll b)
{
	ll ans = 1;
	if(a < b || b < 0 || a < 0)
		return 0;
	for(int i = 0; i < b; i++)
		ans = (ans * (a-i)%mod) % mod;
	return ((ans%mod) * (m%mod))%mod;

}

ll pw(ll x, ll n)
{
	if(n == 0)
		return 1;
	if(n%2 == 0)
		return pw(((x%mod)*(x%mod))%mod, n/2)%mod;
	return (pw((x%mod*x%mod)%mod, n/2)%mod * (x%mod))%mod;

}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	ll n, s;
	cin >> n >> s;
	s += n;
	for(int i = 0; i < n; i++)
	{
		cin >> f[i];
		f[i]++;
	}

	m = 1;
	for(int i = 2; i < n; i++)
		m = ((m%mod) * (i%mod))%mod;
	m = pw(m, mod-2);

	//cout << m << endl;
	ll p = (1 << n);
	for(int i = 0; i < p; i++)
	{
		int t = __builtin_popcount(i);
		b[t].push_back(i);
	}
	ll ans = 0;
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < b[i].size(); j++)
		{
			ll t = s;
			ll x = b[i][j];
			for(int k = 0; k < n; k++)
			{
				if((x >> k) & 1)
					t -= f[k];
			}
		//	cout << t << endl;
			t %= mod;
			if(i%2 == 0)
				ans += C(t-1, n-1);
			else
				ans -= C(t-1, n-1);
			ans += mod;
			ans %= mod;

			//	cout << t << ' ' << C(t-1, n-1) << endl;
		}
	}
	cout << ans%mod << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
ll pow_mod(ll k,ll n)
{
    ll ans = 1;
    while(n)
    {
        if(n&1)
            ans = ans*k%mod;
        k = k*k%mod;
        n >>= 1;
    }
    return ans;
}

ll cal(ll n,ll m)
{
    if(m > n) return 0;
    if(m > n-m) m = n-m;
    ll a = 1,b = 1;
    for(int i = 0; i < m; i++)
    {
        a = a*(n-i)%mod;
        b = b*(i+1)%mod;
    }
    return a*pow_mod(b,mod-2)%mod;
}

ll lucas(ll n,ll m)
{
    if(m==0) return 1;
    return cal(n%mod,m%mod)*lucas(n/mod,m/mod)%mod;
}

int main()
{
    int n;
    ll a[22],s;
    cin>>n>>s;
    for(int i=0;i<n;i++)
        cin>>a[i];

    ll sum = lucas(s+n-1,n-1);
    ll ans = 0;
    //cout<<sum<<endl;
    for(int i=1;i<(1<<n);i++)
    {
        ll temp = s;
        int f = -1;
        for(int j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                temp-=a[j]+1;
                f=-f;
                if(temp<0)
                    break;
            }
        }
        if(temp<0)
            continue;
        ans=((ans+f*lucas(temp+n-1,n-1)%mod)+mod)%mod;
        ans%=mod;
        //cout<<ans<<endl;
    }
    cout<<sum-ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
typedef long long ll;
ll n,a[25],inv[25],f[25],s;

ll qow(ll x,ll y){
	ll ans=1;
	while(y){
		if(y&1) ans=ans*x%mod;
		x=x*x%mod;
		y=y>>1;
	}
	return ans;
}
ll c(ll x,ll y){
	if(x==0||y==0) return 0;
	if(x<0||y<0) return 0;
	ll ans=1;
	for(int i=0;i<=y-1;i++){
		ans=ans*(x-i)%mod;
	}
	return ans*inv[y]%mod;
}
int init(){
	f[0]=1;
	inv[0]=1;
	for(int i=1;i<=20;i++){
		f[i]=f[i-1]*i%mod;
		inv[i]=qow(f[i],mod-2);
	}
}
int main(){
	scanf("%lld%lld",&n,&s);
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	init();
	ll ans=0;
	for(int i=0;i<(1<<n);i++){
		if(i==0){
			ans+=c(n+s-1,n-1);
		}
		else{
			int cnt=0;
			ll t=n+s;
			for(int j=0;j<n;j++){
				if((i>>j)&1) cnt++,t=t-a[j];
			}
			if(cnt%2==1){
				ans=(ans-c(t-cnt-1,n-1))%mod;
			}
			else ans=(ans+c(t-cnt-1,n-1))%mod;
		}
	}
	printf("%lld",(ans+mod)%mod);//如果最后是减号，那么最后极有可能是负数，需要加模数
	return 0;
}

#include<bits/stdc++.h>
using namespace std ;

const int MOD = (int)1e9 + 7;

int factorial(int n){
    if (n == 0)return 1;
    return n * 1LL * factorial(n - 1) % MOD;
}
int nPr(long long n,int r){
    int ret = 1;
    while (r--){
        ret = ret * 1LL * n % MOD;
        n--;
    }
    return ret;
}
int powMod(int base, int power){
    if (power == 0)return 1;
    int ret = powMod(base, power >> 1);
    ret = ret * 1LL * ret % MOD;
    if (power & 1)
        ret = ret * 1LL * base % MOD;
    return ret;
}
int modInverse(int base){
    return powMod(base, MOD - 2);
}
int modInverseOfFactorial(int n){
    return modInverse(factorial(n));
}
int nCr(long long n,int r){
    if (n < r)return 0;
    return nPr(n, r) * 1LL * modInverseOfFactorial(r) % MOD;
}

int possibleAssignmentsUnbounded(int variables, long long sum){
    return nCr(sum + variables - 1, variables - 1);
}
int possibleAssignmentsWithLowerbounds(const vector<long long>& lowerbounds, long long sum) {
    for (int c=0;c<lowerbounds.size();c++)
        sum -= lowerbounds[c];
    if (sum < 0)return 0;
    return possibleAssignmentsUnbounded(lowerbounds.size(), sum);
}
int possibleAssignmentsBounded(const vector<long long>& upperbounds, long long sum){
    int n = upperbounds.size();
    vector<long long> lowerbounds(n);
    int ret = 0;
    for (int mask = 0; mask < (1 << n); mask++){
        int cnt = 0;
        for (int i=0;i<n;i++){
            if (mask & (1<<i)){
                lowerbounds[i] = upperbounds[i] + 1;
                cnt ++;
            }
            else lowerbounds[i] = 0;
        }
        int assignments = possibleAssignmentsWithLowerbounds(lowerbounds, sum);
        if (cnt & 1){
            ret = (ret * 1LL - assignments + MOD) % MOD;
            //cout << "-" << assignments << endl;
        }
        else {
            ret = (ret * 1LL + assignments) % MOD;
            //cout << "+" << assignments << endl;
        }
    }
    return ret;
}

vector<long long> L;
int best[21][1002];

int brute(int i, int rem){
    if (rem == 0)return 1;
    if (i == L.size())return 0;
    int& ret = best[i][rem];
    if (~ret) return ret;
    ret = 0;
    for (int take=0;take<=min(L[i],rem*1LL);take++){
        ret += brute(i + 1, rem - take);
        ret %= MOD;
    }
    return ret;
}

void gen(vector<long long>& R, long long& sum){
    int n = 20;
    R.clear();
    R.resize(n);
    sum = rand() % 1001;
    for (int c=0;c<n;c++)
        R[c] = rand() % 981723;
}

void stressTest(){
    srand(time(NULL));
    long long sum;
    vector<long long> R;
    bool failed = false;
    int passed = 0 ;
    while (!failed) {
        gen(R, sum);
        L = R;
        memset(best, -1, sizeof(best));
        failed |= brute(0, sum) != possibleAssignmentsBounded(R, sum);
        cout << passed << "Passed\n";
        passed ++;
    }
    cout << "Failed\n";
    cout << sum << endl;
    for (int c=0;c<R.size();c++)
        cout << R[c] << " " << endl;
}

int main(){
    //stressTest();
    //freopen("flowers.in","r",stdin);
    int c,c2;
    int n;
    long long sum;
    cin >> n >> sum;
    vector<long long> arr(n);
    for (c=0;c<n;c++){
        long long x;
        cin >> x;
        arr[c] = x;
    }
    cout << possibleAssignmentsBounded(arr, sum) << endl;
    /*
    memset(best, -1, sizeof(best));
    L = arr;
    cout << "brute: " << brute(0, sum) << endl;*/

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
ll a[21],inv;
ll Power(ll x,int y)
{
	ll s=1;
	while (y) {if (y&1) s=s*x%MOD;y>>=1;x=x*x%MOD;}
	return s;
}
ll C(ll x,int y)
{
	ll s=1;
	for (register ll i=x;i>=x-y+1;--i) s=s*i%MOD;
	s=s*inv%MOD;
	return s;
}
ll Lucas(ll x,int y)
{
	if (x<0||y<0||x<y) return 0;if (x==0||y==0) return 1;
	if (x<MOD&&y<MOD) return C(x,y);
	return Lucas(x%MOD,y%MOD)*Lucas(x/MOD,y/MOD)%MOD;
}
int main()
{
	int n;scanf("%d",&n);ll m;scanf("%lld",&m);
	for (register int i=1;i<=n;++i) scanf("%lld",&a[i]);
	inv=1;for (register int i=1;i<=n-1;++i) inv=inv*i%MOD;
	inv=Power(inv,MOD-2);
	ll ans=0;
	for (register int S=0;S<=(1<<n)-1;++S)
	{
		if (S==0) {ans=(ans+Lucas(n+m-1,n-1))%MOD;continue;}
		ll s=0;int p=0;
		for (register int i=1;i<=n;++i) if ((S>>(i-1))&1) s=(s+a[i])%MOD,p++;
		ll t=Lucas(n+m-s-(p+1),n-1);if (p&1) t=-t;
		ans=(ans+t+MOD)%MOD;
	}
	ans=(ans+MOD)%MOD;
	printf("%lld\n",ans);
	return 0;
}

#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>
#define LL long long
#define Rg register
#define RI register int
#define RC register char
#define ed puts("")
#define pair pair<LL,LL>
#define space putchar(' ')
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
template <typename tp> inline void read(tp & x)
{
    x=0;
    RI f=1;
    RC c=getchar();
    while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar(); }
    while(c>='0' && c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
    x*=f;
}

template <typename Tp> inline void print(Tp x)
{
    if(x<0) x=-x,putchar('-');
    if(x>9) print(x/10);
    putchar(x%10+'0');
}

const LL mod=1000000007;
LL n,m,a[105],jc[105];

inline LL mul(LL x,LL y)
{
	LL ret=0;
	for(;y;y>>=1)
	{
		if(y&1) ret=(ret+x)%mod;
		x=(x+x)%mod;
	}
	return ret;
}

inline LL Pow(LL x,LL y)
{
	LL res=1;
	for(;y;y>>=1)
	{
		if(y & 1) res=mul(res,x);
		x=mul(x,x);
	}
	return res;
}

inline void make_jiecheng_list()
{
	jc[0]=1;
	for(RI i=1;i<=25;++i)
	{
		jc[i]=(jc[i-1]*i)%mod;
	}
	return;
}

inline LL P(LL a,LL b)
{
	LL res=1;
	LL c=a-b+1;
	for(RI i=a;i>=c;--i)
	{
		res=mul(res,i);
	}
	return res;
}

inline LL C(LL a,LL b)
{
	if(a<0 || b<0 || a<b)
		return 0;
	if(a==0 || b==0) return 1;
	LL JC=jc[b];
	LL niyuan=Pow(JC,mod-2);
	LL pailie=P(a,b);
	pailie=(pailie*niyuan)%mod;
	return pailie;
}

//inline LL C(LL a,LL b)
//{
//	if(a<0 || b<0 || a<b)
//		return 0;
//	if(a==0 || b==0) return 1;
//	LL res=jc[a];
//	LL niyuan1=Pow(jc[b],mod-2);
//	LL niyuan2=Pow(jc[a-b],mod-2);
//	res=(res*niyuan1)%mod;
//	res=(res*niyuan2)%mod;
//	return res;
//}

int main()
{
	read(n),read(m);
	for(RI i=1;i<=n;++i)
		read(a[i]);
	make_jiecheng_list();
	LL ans=0;
	for(RI i=0;i<(1<<n);++i)
	{
		if(i==0)
		{
			ans=(ans+C(n+m-1,n-1))%mod;
		}
		else
		{
			LL temp=n+m;
			int p=0;
			for(RI j=0;j<n;++j)
			{
				if(i>>j & 1)
				{
					p++;
					temp-=a[j+1];
				}
			}
			temp-=p+1;
			if(p&1)
			{
				ans=(ans-C(temp,n-1))%mod;
			}
			else
			{
				ans=(ans+C(temp,n-1))%mod;
			}
		}
	}
	ans=(ans+mod)%mod;
	print(ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int MOD = 1e9 + 7;
vector<pair<long long, long long>> poly = {{0ll, 1ll}};

void mul(int f) {
  vector<pair<long long, long long>> add;
  for (auto [n, a] : poly) {
    add.emplace_back(n + f, (MOD - a) % MOD);
  }
  poly.insert(poly.end(), add.begin(), add.end());
  sort(poly.begin(), poly.end());
  int m = 0;
  for (int i = 0, j = 0; i < poly.size(); i = j) {
    long long coef = 0;
    while (j < poly.size() and poly[i].first == poly[j].first) {
      (coef += poly[j].second) %= MOD;
      ++j;
    }
    poly[m++] = {poly[i].first, coef};
  }
  poly.resize(m);
}

long long inv(long long a) {
  long long ans = 1;
  for (long long cur = a, p = MOD - 2; p; p >>= 1, cur = cur * cur % MOD) {
    if (p&1) {
      ans = ans * cur % MOD;
    }
  }
  return ans;
}

long long C(long long a, long long b) {
  a %= MOD;
  long long ans = 1;
  for (; b > 0; --b, --a) {
    ans = ans * a % MOD * inv(b) % MOD;
  }
  return ans;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  long long s; cin >> s;
  for (int i = 0; i < n; ++i) {
    long long f; cin >> f;
    mul(f + 1);
  }

  long long ans = 0;

  for (auto [t, a] : poly) {
    long long gap = s - t;
    if (gap >= 0) (ans += 1ll * a * C(gap + n - 1, n - 1) % MOD) %= MOD;
  }
  cout << ans << '\n';
}

#include <bits/stdc++.h>
using namespace std;
int n;
const int MOD=1000000007;
//Extended euclidean algorithm

long long extended_euclid(long long a,long long b,long long &x,long long &y)
{
    if(b==0)
    {
        x=1,y=0;
        return a;
    }
    //swap a ,b and swap their x, y
    long long g=extended_euclid( b , a%b , y , x );
    //now our x = previous y
    y -= (a / b) * x;

    return g;
}

long long modInverse(long long a,long long m)
{
    long long x,y;
    long long d = extended_euclid(a,m,x,y);
    if(d>1)
        return -1;
    return (x+m)%m;
}

vector<long long> InMod;
void fillIn()
{
    long long ans=1;
    for(int i=1;i<=n;i++)
    {
        ans*=i;
        InMod[i]=modInverse(ans,MOD);
    }
}
int main()
{
    long long s;
    cin>>n>>s;
    InMod.resize(n+1);
    InMod[0]=1;
    fillIn();

    long long f[n];
    for(int i=0;i<n;i++)
    {
        cin>>f[i];
    }
    int lim=1;
    for(int i=0;i<n;i++)
    {
        lim*=2;
    }
    long long ans=0;
    for(int i=0;i<lim;i++)
    {
        //cout<<i<<endl;
        long long prod=s;
        int k=i;
        int j=0;
        int co=0;
        while(k>>j)
        {
            //cout<<j<<" j"<<endl;
            if((k>>j)%2!=0)
            {
                //cout<<"IN"<<endl;
                co++;
                prod=prod-f[j]-1;

            }
            j++;
        }
        if(prod<0)
            continue;
        //cout<<prod<<endl;
        if(n>1)
            prod++;
        for(int l=1;l<n-1;l++)
        {
            prod=((prod%MOD)*((prod+l)%MOD))%MOD;
            //prod%=MOD;
        }
        //cout<<co<<endl;
        //cout<<prod<<" Prod"<<endl;
        //cout<<((prod%MOD)*(InMod[n-1]%MOD))%MOD<<" Prod and mod"<<endl;
        //cout<<MOD<<" "<<InMod[n-1]<<endl;
        /*if(((prod%MOD)*(InMod[n-1]%MOD))%MOD<0)
            continue;*/
        if(co%2==0)
            ans+=((prod%MOD)*(InMod[n-1]%MOD))%MOD;
        else
            ans-=((prod%MOD)*(InMod[n-1]%MOD))%MOD;
        ans%=MOD;
        //cout<<ans<<" aaa"<<endl;
    }
    cout<<ans<<endl;
}

#include <cstdio>

typedef long long ll;

const ll mod = 1000000000 + 7;

const int maxn = 20 + 10;

ll f[maxn];

ll inv(ll a)
{
    ll r = 1, n = mod - 2;
    while(n)
    {
        if(n & 1) r = r * a % mod;
        n >>= 1;
        a = a * a % mod;
    }
    return r;
}

ll C(ll n, ll m)
{
    if(n < m) return 0;
    if(m == 0 || m == n) return 1;

    if(m > n - m) m = n - m;

    ll r = 1;
    for(ll i = n; i >= n - m + 1; i--) r = r * i % mod;
    for(ll i = 1; i <= m; i++) r = r * inv(i) % mod;
    return r;
}

int main()
{
    int n; ll s;

    scanf("%d%I64d", &n, &s);

    for(int i = 0; i < n; i++) scanf("%I64d", &f[i]);

    ll ans = 0;
    ll t; int cnt;
    for(int i = 0; i < (1 << n); i++)
    {
        t = s; cnt = 0;
        for(int j = 0; j < n; j++) if((1 << j) & i)
        {
            t -= f[j] + 1;
            if(t < 0) break;
            cnt++;
        }
        if(t < 0) continue;
        if(cnt & 1) ans = (ans - C(t + n - 1, n - 1)) % mod;
        else ans = (ans + C(t + n - 1, n - 1)) % mod;
    }
    ans = (ans + mod) % mod;
    printf("%I64d\n", ans);
    return 0;
}

//niiick
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long lt;

lt read()
{
    lt f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

const lt mod=1e9+7;
const int maxn=50;
lt a[maxn],inv[maxn];
lt ans;

lt C(lt n,lt m)
{
    if(n<0||m<0||n<m)return 0;
    if(n%mod==0||m==0)return 1;
    lt res=1;
    for(lt i=n-m+1;i<=n;++i)
    res*=(i%mod),res%=mod;
    /*for(int i=1;i<=m;++i)
    res*=inv[i],res%=mod;*/
	for(lt i=1;i<=m;i++)res/=i;
    return res;
}

lt qpow(lt b,lt k)
{
    lt res=1;
    while(k>0)
    {
        if(k&1)res=(res*b)%mod;
        b=(b*b)%mod;
        k>>=1;
    }
    return res;
}

int main()
{
    lt n=read(),m=read();
    for(int i=1;i<=n;++i)a[i]=read();
    for(int i=1;i<=20;++i)inv[i]=qpow(i,mod-2);

    ans=C(n+m-1,n-1)%mod;
    for(int i=1;i<=(1<<n)-1;++i)
    {
        lt k=n+m,p=0;
        for(int j=0;j<n;++j)
        {
        	if((1<<j)&i)//判断第j位是否为1
			{
				p++;
				k-=a[j+1];
			}
    	}
        k-=p+1;
        if(p%2)ans-=C(k,n-1),ans%=mod;
        else ans+=C(k,n-1),ans%=mod;
    }
    printf("%lld",(ans+mod)%mod);
    return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll f[22];
ll inv[22];

ll rep(ll n,ll r){ // nHr
	// n+r-1 C r = (n+r-1)! / r!(n-1)!
	ll ret = 1;
	if(r<0) return 0;

	for(int i=0;i<n-1;i++){
		ret *= (n+r-1-i);
		ret %= MOD;
	}

	for(int i=1;i<=n-1;i++){
		ret *= inv[i];
		ret %= MOD;
	}
	return ret;
}

ll mypow(ll x,ll y){
	if(y==0) return 1;
	if(y%2) return (mypow(x,y-1)*x)%MOD;
	ll half = mypow(x,y/2);
	return (half*half)%MOD;
}

ll get_inv(ll x){return mypow(x,MOD-2);}

int main(){
	for(int i=1;i<22;i++)inv[i]=get_inv(i);

	ll n,s;
	cin>>n>>s;
	for(int i=1;i<=n;i++)cin>>f[i];
	ll ans = 0;

	for(int i=0;i<(1<<n);i++){
		int cnt=0; ll sub=0;
		for(int j=1;j<=n;j++){
			if(i&(1<<(j-1))){
				cnt++;
				sub += (f[j]+1);
			}
		}

		ll now = rep(n,s-sub);
		if(cnt%2) ans -= now;
		else ans += now;
		while(ans<0) ans += MOD;
		ans%=MOD;
	}

	cout<<ans;
}

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
const LL mod=1e9+7;
const int MAXN=30;
LL s,a[MAXN],inv[MAXN];
int n;
LL qsm(LL a,LL b){
	LL ans=1;
	while(b){
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
LL C(int x, LL y){
	if(y<0 || x<0 || y<x) return 0;
	y%=mod;
	LL ans=1;
	for(int i=0;i<x;i++){
		ans=ans*(y-i)%mod;
	}
	for(int i=1;i<=x;i++){
		ans=ans*inv[i]%mod;
	}
	return ans;
}
void Init(){
	for(int i=1;i<=20;i++) inv[i]=qsm(i,mod-2);
}
int main(){
	Init();

	scanf("%d%I64d",&n,&s);
	for(int i=1;i<=n;i++){
		scanf("%I64d",&a[i]);
	}

	LL ans=0;
	for(int S=0;S<=(1<<n)-1;S++){
		if(S==0){
			ans+=C(n-1,n+s-1);
			continue ;
		}

		int cnt=0;LL now=n+s-1;
		for(int i=1;i<=n;i++){
			if(S&(1<<(i-1))){
				cnt++;
				now=now-a[i]-1;
			}
		}

		if(cnt&1) ans-=C(n-1,now);
		else ans+=C(n-1,now);

	//	std:: cout<<ans<<" ";
	}

	printf("%I64d",(ans+mod)%mod);
	return 0;
}

#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#define sf scanf
#define pf printf
#define ll long long
using namespace std;
struct point
{
    ll x,y;
    point(){}
    point(ll a,ll b):x(a),y(b){}
};
point a[2000000];
int n,tot;
ll s;
const int mod = 1e9 + 7;
ll k1,k2,f[22];
inline bool cmp(point a,point b)
{
    return a.x < b.x;
}
ll extend_gcd(ll a,ll b,ll &x,ll &y)
{
    if (b == 0)
    {
        x = 1; y = 0;
        return a;
    }
    ll r = extend_gcd(b,a % b,y,x);
    y -= x * (a / b);
    return r;
}
inline ll NI(ll x)
{
    k1 = k2 = 0;
    extend_gcd(x,mod,k1,k2);
    return (k1 % mod + mod) % mod;
}
inline ll C(ll n,ll m)
{
    ll ans = 1;
    for (ll i = n; i >= n - m + 1; i--) ans = (ans * i) % mod;
    for (ll i = 2; i <= m; i++) ans = (ans * NI(i)) % mod;
    return (ans % mod + mod) % mod;
}
int main()
{
    cin>>n>>s;
    for (int i = 1; i <= n; i++)
    {
        cin>>f[i];
        f[i]++;
    }
    tot = 2;
    a[1].x = f[1]; a[1].y = -1;
    a[2].x = 0; a[2].y = 1;
    for (int i = 2; i <= n; i++)
    {
        int tmp = tot;
        for (int j = 1; j <= tmp; j++)
        {
            ll x = a[j].x + f[i],y = -a[j].y;
            a[++tot] = point(x,y);
        }
    }
    ll ans = 0;
    for (int i = 1; i <= tot; i++)
    {
        ll r = s - a[i].x;
        if (r < 0) continue;
        ll tmp = C(r + n - 1,n - 1) % mod;
        ans = (ans + (tmp * a[i].y) % mod) % mod;
    }
    ans = (ans  % mod + mod) % mod;
    pf("%I64d\n",ans);
    return 0;
}

#include <bits/stdc++.h>
#define MOD 1000000007LL
typedef long long ll;
using namespace std;

ll modexp(ll b, ll e) {
    if (e == 0) return 1;
    if (e % 2) {
        return (b * modexp(b, e - 1)) % MOD;
    }

    ll tmp = modexp(b, e / 2);
    return (tmp * tmp) % MOD;
}

int main() {
    ll n, s;
    cin >> n >> s;
    ll f[n];
    for (ll i = 0; i < n; ++i) {
        cin >> f[i];
    }

    ll fac[n + 1];
    ll invFac[n + 1];
    fac[0] = 1;
    invFac[0] = 1;
    for (ll i = 1; i <= n; ++i) {
        fac[i] = (i * fac[i - 1]) % MOD;
        invFac[i] = modexp(fac[i], MOD - 2);
    }

    unordered_map<ll, ll> co;

    for (ll mask = 0; mask < (1LL << n); ++mask) {
        ll sum = 0;
        bool sign = true;
        for (ll i = 0; i < n; ++i) {
            if (mask & (1 << i)) {
                sign = !sign;
                sum += (f[i] + 1);
            }
        }

        if (co.find(sum) == co.end()) {
            co.insert({ sum, 0 });
        }

        if (sign) ++co[sum];
        else --co[sum];
    }

    ll rs = 0;
    for (auto it : co) {
        ll index = it.first;
        ll value = it.second;

        if (n + s - index - 1 < 0 || s - index < 0) continue;

        ll x = invFac[n - 1];
        for (ll j = 1; j < n; ++j) {
            x = (x * (MOD + (s % MOD) - (index % MOD) + j)) % MOD;
        }

        rs = (rs + (value % MOD) * (x % MOD)) % MOD;
    }

    cout << rs << endl;
    return 0;
}