Language: C++

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

/*
#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
*/
 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////



//from KaedeTakagaki
//from https://judge.yosupo.jp/submission/7396
template<const ll md>
struct ntt{
    inline void add(ll &a, ll b) { a += b; if(a >= md) a -= md; }
    inline void sub(ll &a, ll b) { a -= b; if(a < 0) a += md; }
    inline ll add2(ll a, ll b) { a += b; if(a >= md) a -= md; return a;}
    inline ll sub2(ll a, ll b) { a -= b; if(a < 0) a += md; return a;}
    inline ll mul(ll a, ll b) { return (ll)((ll)a*b%md); }
    inline ll power(ll a, long long b) {
        ll res = 1;
        while (b > 0) {
            if (b & 1) res = mul(res, a);
            a = mul(a, a);
            b >>= 1;
        }
        return res;
    }
    inline ll inv(ll a) {
        a %= md;
        if (a < 0) a += md;
        ll b = md, u = 0, v = 1;
        while (a) {
            ll 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;
    }
    
     ll max_base, root;
    vector<ll> dw, idw;
    ntt() {
        ll tmp = md - 1;
        max_base = 0;
        while (tmp % 2 == 0) {
            tmp /= 2;
            max_base++;
        }
        root = 2;
        while (power(root, (md-1)>>1) == 1) root++;
        dw.resize(max_base); idw.resize(max_base);
        
        rep(i,0,max_base-1){
            sub(dw[i], power(root, (md-1) >> (i+2)));
            idw[i] = inv(dw[i]);
        }
    }
    void fft(vector<ll> &a, bool inv) {
        const ll n = a.size();
        assert((n & (n - 1)) == 0);
        assert(__builtin_ctz(n) <= max_base);
        if(!inv){
            for(ll m=n;m>>=1;){
                ll w = 1;
                for(ll s=0,k=0; s<n; s += 2*m){
                    for(ll i=s, j=s+m ; i < s+m; ++i, ++j) {
                        ll x = a[i], y = mul(a[j], w);
                        a[j] = (x>=y?x-y:x+md-y);
                        a[i] = (x+y>=md?x+y-md:x+y);
                    }
                    w = mul(w, dw[__builtin_ctz(++k)]);
                }
            }
        }
        else{
            for(ll m=1;m<n;m*=2){
                ll w = 1;
                for(ll s=0,k=0; s<n; s += 2*m){
                    for(ll i=s, j=s+m ; i < s+m; ++i, ++j) {
                        ll x = a[i], y = a[j];
                        a[j] = (x>=y?x-y:x+md-y);
                        a[j] = mul(a[j], w);
                        a[i] = (x+y>=md?x+y-md:x+y);
                    }
                    w = mul(w, idw[__builtin_ctz(++k)]);
                }
            }
        }
    }
    vector<ll> multiply(vector<ll> a, vector<ll> b, ll eq = 0) {
        ll need = a.size() + b.size() - 1;
        ll nbase = 0;
        while ((1 << nbase) < need) nbase++;
        ll sz = 1 << nbase;
        a.resize(sz);
        b.resize(sz);
        fft(a, 0);
        if (eq) b = a; else fft(b, 0);
        ll inv_sz = inv(sz);
        for (ll i = 0; i < sz; i++) {
            a[i] = mul(mul(a[i], b[i]), inv_sz);
        }
        fft(a, 1);
        a.resize(need);
        return a;
    }
    vector<ll> square(vector<ll> a) {
        return multiply(a, a, 1);
    }
};
/*
167772161; //= 2^25 * 5 + 1
469762049; //= 2^26 * 7 + 1
754974721; //= 2^24 * 45 + 1
1045430273; //= 2^20 * 997 + 1
1051721729; //= 2^20 * 1003 + 1
1053818881; //= 2^20 * 1005 + 1
*/


ll LIMIT;
template<const ll md>
vector<ll> anyntt(vector<ll>&a, vector<ll>&b, ll eq = 0) {
    
    for(auto &x:a)if(x<0)x=mod(x);
    for(auto &x:b)if(x<0)x=mod(x);
    
    //今回は2^20以下だからこっちの方が速い (らしい) (:maroon_kansha:)
  //  const ll m1 = 167772161, m2 = 469762049, m3 = 754974721;
    const ll m1=1045430273,m2=1051721729,m3=1053818881;
    ntt<m1>n1;
    ntt<m2>n2;
    ntt<m3>n3;
    ntt<md>nn;
    auto a1  = n1.multiply(a, b, eq);
    auto a2 = n2.multiply(a, b, eq);
    auto a3  = n3.multiply(a, b, eq);
    const ll n = a1.size();
    vector<ll>ret(n);
    vector<ll>m; m = {m1, m2, m3};
    vector<ll>r; r = {1, n2.inv(m1), n3.inv(n3.mul(m1, m2))};
    ll mm = nn.mul(m1, m2);
    
    rep(i,0,n-1){
        n2.add(a2[i], n2.sub2(m2, a1[i]));
        ll v1 = n2.mul(a2[i], r[1]);
        n3.add(a3[i], n3.sub2(m3, n3.add2(a1[i], n3.mul(m1, v1))));
        ll v2 = n3.mul(a3[i], r[2]);
        nn.add(a1[i], nn.add2(nn.mul(m1, v1), nn.mul(mm, v2)));
        ret[i] = a1[i];
    }
    whlie(ret.size()>LIMIT+1){
    ret.pop_back();
    }
    return ret;
}
//////////////////////////////////

vector<ll>a;

vector<ll>cal(ll l,ll r){
    
    if(l+20>=r){
        vector<ll>v(LIMIT+1);
        ll n=r-l;
        rep(i,0,(1ll<<n)-1){
            
            ll sum=0;
            ll cnt=0;
            rep(j,0,n-1){
                if((i>>j)&1){
                    cnt++;
                    sum+=a[l+j]+1;
                }
            }
            if(sum>LIMIT)continue;
            if(cnt%2==0)v[sum]++;
            else v[sum]--;
        }
        
        return v;
    }
    ll m=(l+r)/2;
    vector<ll> vl=cal(l,m), vr=cal(m,r);
    return anyntt<i_7>(vl,vr);
}

int main(){fastio
    ll n,k;cin>>n>>k;
    LIMIT=k;
    a.resize(n);
    rep(i,0,n-1)cin>>a[i];
    
    vector<ll>dp=cal(0,n);
    
    //for(auto x:dp)cout<<x<<" ";
    rep(zz,1,n){
        rep(i,1,min(dp.size()-1,k)){
            Add(dp[i],dp[i-1]);
        }
       // for(auto x:dp)cout<<x<<" ";cout<<endl;
    }
    cout<<mod(dp[k])<<endl;
    
    return 0;
}



Compiler output:
a.cc: In function 'std::vector<long long int> anyntt(std::vector<long long int>&, std::vector<long long int>&, ll)':
a.cc:225:5: error: there are no arguments to 'whlie' that depend on a template parameter, so a declaration of 'whlie' must be available [-fpermissive]
  225 |     whlie(ret.size()>LIMIT+1){
      |     ^~~~~
a.cc:225:5: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:225:30: error: expected ';' before '{' token
  225 |     whlie(ret.size()>LIMIT+1){
      |                              ^
      |                              ;
a.cc: In instantiation of 'std::vector<long long int> anyntt(std::vector<long long int>&, std::vector<long long int>&, ll) [with long long int md = 1000000007; ll = long long int]':
a.cc:258:23:   required from here
  258 |     return anyntt<i_7>(vl,vr);
      |            ~~~~~~~~~~~^~~~~~~
a.cc:225:10: error: 'whlie' was not declared in this scope
  225 |     whlie(ret.size()>LIMIT+1){
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~