#include <bits/stdc++.h>
using namespace std;
const long long INF = 10000000000LL;
long long r197(long long n) { return n % 1000000007; }
vector<int> v[100001];
bool b[100005] = {};
struct edge {
  int score;
  int num;
};
int n;
int k;
int p[103];
long long dp[101][100005] = {};
long long reg(int m, int s) {
  if (dp[s][m] != -1) return dp[s][m];
  if (s == k) return 1;
  if (m == n) return 0;
  long long res = 0;
  for (int i = 0; i < p[m] + 1; ++i) {
    if (s + i > k) break;
    res = r197(res + (reg(m + 1, s + i)));
  }
  return dp[s][m] = res;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < k + 1; ++j) {
      dp[i + 1][j] = r197(dp[i + 1][j] + dp[i][j]);
      dp[i + 1][min(j + p[i], k) + 1] =
          r197(dp[i + 1][min(j + p[i], k) + 1] - dp[i][j]);
    }
    for (int j = 1; j < k + 1; ++j) {
      dp[i + 1][j] = r197(dp[i + 1][j] + dp[i + 1][j - 1]);
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
