#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}
bool prime(long long x) {
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return x != 1;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long kai(long long x, long long y) {
  long long res = 1;
  for (long long i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= (long long)(1e9 + 7);
  }
  return res;
}
long long mod_pow(long long x, long long y,
                  long long m = (long long)(1e9 + 7)) {
  long long res = 1;
  x %= m;
  while (y > 0) {
    if (y & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    y >>= 1;
  }
  return res;
}
long long comb(long long x, long long y) {
  if (y > x) return 0;
  return kai(x, y) *
         mod_pow(kai(y, y), (long long)(1e9 + 7) - 2, (long long)(1e9 + 7)) %
         (long long)(1e9 + 7);
}
long long get_rand(long long MIN, long long MAX) {
  std::random_device rnd;
  std::mt19937 mt32(rnd());
  std::uniform_int_distribution<long long> engine(MIN, MAX);
  return engine(mt32);
}
struct BIT {
  vector<long long> bit;
  long long n;
  BIT(long long x) {
    bit.resize(x + 1, 0);
    n = x;
  }
  void add(long long x, long long y) {
    while (x <= n) {
      bit[x] += y;
      x += x & -x;
    }
  }
  long long sum(long long x) {
    long long res = 0;
    while (x > 0) {
      res += bit[x];
      x -= x & -x;
    }
    return res;
  }
};
struct UnionFind {
  vector<long long> par, size;
  UnionFind(long long x) {
    par.resize(x);
    size.resize(x, 1);
    for (long long i = 0; i < x; i++) par[i] = i;
  }
  long long find(long long x) {
    if (par[x] == x) return x;
    return par[x] = find(par[x]);
  }
  bool same(long long x, long long y) { return find(x) == find(y); }
  long long consize(long long x) { return size[find(x)]; }
  void unite(long long x, long long y) {
    x = find(x), y = find(y);
    if (x == y) return;
    if (size[x] < size[y]) {
      par[x] = y;
      size[y] += size[x];
    } else {
      par[y] = x;
      size[x] += size[y];
    }
  }
};
struct Tree {
  long long size;
  vector<long long> par, depth;
  vector<long long> doubling[30];
  vector<vector<long long>> G;
  long long root = 0;
  Tree(long long x) {
    par.resize(x);
    depth.resize(x);
    for (long long i = 0; i < 30; i++) {
      doubling[i].resize(x, -1);
    }
    G.resize(x);
    size = x;
  }
  void add_edge(long long x, long long y) {
    G[x].push_back(y);
    G[y].push_back(x);
  }
  void dfs(long long x) {
    for (long long i : G[x]) {
      if (depth[i] == -1) {
        depth[i] = depth[x] + 1;
        doubling[0][i] = x;
        dfs(i);
      }
    }
  }
  void init() {
    for (long long i = 0; i < size; i++) depth[i] = -1;
    depth[root] = 0;
    dfs(root);
    for (long long i = 0; i < 29; i++) {
      for (long long j = 0; j < size; j++) {
        if (doubling[i][j] == -1)
          doubling[i + 1][j] = -1;
        else
          doubling[i + 1][j] = doubling[i][doubling[i][j]];
      }
    }
  }
  long long lca(long long x, long long y) {
    if (depth[x] > depth[y]) swap(x, y);
    for (long long i = 29; i >= 0; i--) {
      if ((depth[y] - depth[x]) >> i & 1) {
        y = doubling[i][y];
      }
    }
    if (x == y) return x;
    for (long long i = 29; i >= 0; i--) {
      if (doubling[i][x] != doubling[i][y]) {
        x = doubling[i][x];
        y = doubling[i][y];
      }
    }
    return doubling[0][x];
  }
};
struct RollingHash {
  long long Base = 283;
  const long long MASK30 = (1ll << 30) - 1;
  const long long MASK31 = (1ll << 31) - 1;
  const long long MOD = (1ll << 61) - 1;
  vector<long long> hash, power;
  long long calcmod(long long val) {
    val = (val & MOD) + (val >> 61);
    if (val > MOD) val -= MOD;
    return val;
  }
  long long mul(long long x, long long y) {
    long long xu = x >> 31;
    long long xd = x & MASK31;
    long long yu = y >> 31;
    long long yd = y & MASK31;
    long long mid = xd * yu + xu * yd;
    long long midu = mid >> 30;
    long long midd = mid & MASK30;
    return calcmod(xu * yu * 2 + midu + (midd << 31) + xd * yd);
  }
  RollingHash(string s) {
    long long sz = s.size();
    hash.resize(sz + 1, 0);
    power.resize(sz + 1, 1);
    for (long long i = 0; i < sz; i++) {
      hash[i + 1] = (mul(hash[i], Base) + s[i]) % MOD;
      power[i + 1] = mul(power[i], Base) % MOD;
    }
  }
  long long get(long long l, long long r) {
    long long res = (hash[r] - mul(hash[l], power[r - l]) + MOD) % MOD;
    return res;
  }
  long long lcp(long long x, long long y) {
    long long len = min(hash.size() - y, hash.size() - x);
    long long ok = 0, ng = len + 1;
    while (ng - ok > 1) {
      long long mid = (ok + ng) / 2;
      if (get(x, x + mid) == get(y, y + mid))
        ok = mid;
      else
        ng = mid;
    }
    return ok;
  }
};
struct Segtree {
  long long size = 1;
  vector<long long> dat, lazy;
  Segtree(long long x) {
    while (size < x) size *= 2;
    dat.resize(size * 2 - 1, (long long)(3e18));
    lazy.resize(size * 2 - 1, (long long)(3e18));
  }
  void eval(long long k, long long l, long long r) {
    chmin(dat[k], lazy[k]);
    if (r - l > 1) {
      chmin(lazy[k * 2 + 1], lazy[k]);
      chmin(lazy[k * 2 + 2], lazy[k]);
    }
    lazy[k] = (long long)(3e18);
  }
  void update(long long a, long long b, long long x, long long k = 0,
              long long l = 0, long long r = -1) {
    if (r == -1) r = size;
    eval(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      chmin(lazy[k], x);
      eval(k, l, r);
      return;
    }
    update(a, b, x, k * 2 + 1, l, (l + r) / 2);
    update(a, b, x, k * 2 + 2, (l + r) / 2, r);
    dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
  long long query(long long a, long long k = 0, long long l = 0,
                  long long r = -1) {
    if (r == -1) r = size;
    eval(k, l, r);
    if (r - l == 1) {
      return dat[k];
    }
    if (a < (l + r) / 2) {
      return query(a, k * 2 + 1, l, (l + r) / 2);
    }
    return query(a, k * 2 + 2, (l + r) / 2, r);
  }
};
template <class T>
vector<long long> KMP(vector<T> target, vector<T> pattern) {
  vector<long long> table(pattern.size() + 1);
  table[0] = 0;
  long long j = 0;
  for (long long i = 1; i < (long long)pattern.size(); i++) {
    if (pattern[i] == pattern[j]) {
      table[i] = j++;
    } else {
      table[i] = j;
      j = 0;
    }
  }
  table[pattern.size()] = j;
  j = 0;
  vector<long long> res;
  long long i = 0;
  while (i < target.size()) {
    if (j < pattern.size() && target[i] == pattern[j]) {
      i++;
      j++;
    } else {
      if (!j) i++;
      j = table[j];
    }
    if (j == pattern.size()) res.push_back(i - j);
  }
  return res;
}
long long perm[1000005];
void init_perm() {
  perm[0] = 1;
  for (long long i = 1; i < 1000005; i++)
    perm[i] = perm[i - 1] * i % (long long)(1e9 + 7);
}
long long nCk(long long x, long long y) {
  return perm[x] * mod_pow(perm[x - y], (long long)(1e9 + 7) - 2) %
         (long long)(1e9 + 7) * mod_pow(perm[y], (long long)(1e9 + 7) - 2) %
         (long long)(1e9 + 7);
}
long long N, K, a[105];
long long dp[105][200005];
signed main() {
  cin >> N >> K;
  for (long long i = 0; i < N; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < K + 1; j++) {
      dp[i][j] %= (long long)(1e9 + 7);
      dp[i][j + 1] += dp[i][j];
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j + a[i] + 1] -= dp[i][j];
    }
  }
  cout << dp[N][K] % (long long)(1e9 + 7) << endl;
}
