#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;
int n;
ll T;
vector<ll> t;
vector<ll> fact;
ll mod_pow(ll b, ll e) {
  ll res = 1LL;
  while (e) {
    if (e & 1) res = (res * b) % MOD;
    b = (b * b) % MOD;
    e >>= 1;
  }
  return res;
}
ll mod_inv(ll den) { return mod_pow(den, MOD - 2); }
ll bin_coeff(ll n, ll k) {
  return (fact[n] * mod_inv(fact[k] * fact[n - k] % MOD)) % MOD;
}
int main() {
  scanf("%d %lld", &n, &T);
  t.resize(n + 2);
  fact.resize(n + 1);
  t[0] = 0;
  t[n + 1] = INF;
  for (int i = 1; i <= n; ++i) scanf("%lld", &t[i]);
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) fact[i] = (fact[i - 1] * i) % MOD;
  ll den = 1;
  ll sum = 0;
  ll ans = 0;
  for (int i = 0; i <= n; ++i) {
    den = (den << 1) % MOD;
    sum += t[i];
    if (sum > T) break;
    ll thresh = T - t[i + 1];
    if (thresh >= sum && thresh <= sum + i)
      ans = (ans + (i * bin_coeff(i, thresh - sum)) % MOD * mod_inv(den)) % MOD;
    for (ll j = max(sum, thresh + 1); j <= min(sum + i, T); ++j)
      ans = (ans + (2 * i * bin_coeff(i, j - sum)) % MOD * mod_inv(den)) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}
