#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct Point {
  long long x, y;
  Point(long long x, long long y) : x(x), y(y) {}
  Point() : x(0), y(0) {}
  Point operator+(Point v) { return Point(x + v.x, y + v.y); }
  Point operator-(Point v) { return Point(x - v.x, y - v.y); }
  bool operator==(const Point &v) const { return x == v.x && y == v.y; }
  bool operator<(const Point &p1) const { return x < p1.x && y < p1.y; }
};
ostream &operator<<(ostream &out, Point const &v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}
istream &operator>>(istream &in, Point &v) {
  long long x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}
class Vector2 {
 public:
  double x, y;
  Vector2(double x = 0, double y = 0) : x(x), y(y) {}
  Vector2 operator+(Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator-(Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator*(double k) { return Vector2(x * k, y * k); }
  Vector2 operator/(double k) { return Vector2(x / k, y / k); }
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot(Vector2 v) { return x * v.x + y * v.y; }
  double cross(Vector2 v) { return x * v.y - y * v.x; }
  bool operator<(const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  bool operator==(const Vector2 &v) const {
    return fabs(x - v.x) < 0.0000000001 && fabs(y - v.y) < 0.0000000001;
  }
};
ostream &operator<<(ostream &out, Vector2 const &v) {
  out << "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}
istream &operator>>(istream &in, Vector2 &v) {
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}
vector<long long> slice(vector<long long> &vec, int s, int t) {
  return vector<long long>(vec.begin() + s, vec.begin() + t);
}
vector<long long> trim(vector<long long> &vec, int n) {
  auto init = slice(vec, 0, n);
  auto tail = slice(vec, n + 2, vec.size());
  init.insert(init.end(), tail.begin(), tail.end());
  return init;
}
long long N, K;
vector<long long> A;
void input() {
  cin >> N >> K;
  long long a;
  for (long long n = 0; n < N; n++) {
    cin >> a;
    A.push_back(a);
  }
}
long long dp[110][100100];
long long rec(long long n, long long k) {
  long long &cache = dp[n][k];
  if (~cache) return cache;
  if (k == 0) return cache = 1;
  if (n == N) return cache = 0;
  long long ways = 0;
  long long max_ = min(k, A[n]);
  for (long long take = 0; take < max_ + 1; take++) {
    ways += rec(n + 1, k - take);
    ways %= 1000000007;
  }
  return cache = ways;
}
long long memoRec() {
  for (long long n = 0; n < N + 1; n++)
    for (long long k = 0; k < K + 1; k++) dp[n][k] = -1;
  return rec(0, K);
}
long long acc[100100];
long long receive() {
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long n = 1; n < N + 1; n++) {
    for (long long k = 0; k < K + 1; k++) {
      acc[k + 1] = (acc[k] + dp[n - 1][k]) % 1000000007;
    }
    for (long long k = 0; k < K + 1; k++) {
      dp[n][k] =
          (acc[k + 1] - acc[max(0LL, k - A[n - 1])] + 1000000007) % 1000000007;
    }
  }
  return dp[N][K];
}
void dump() {
  for (long long k = 0; k < K + 1; k++) {
    for (long long n = 0; n < N + 1; n++) {
      cout << dp[n][k] << " ";
    }
    cout << endl;
  }
}
void solve() {
  long long r = receive();
  cout << r << endl;
}
int main() {
  input();
  solve();
  return 0;
}
