#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const long long M = 1e9 + 7;
const long long INF = 1e18;
long long dp[105][100005];
int main() {
  int n, sum, x;
  scanf("%d", &n);
  scanf("%d", &sum);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    if (i) {
      for (int j = 0; j <= x; j++) {
        dp[i][j] = dp[i - 1][j];
      }
      x++;
      for (int j = x; j < N; j++) {
        dp[i][j] = dp[i - 1][j] - dp[i - 1][j - x];
      }
    } else {
      for (int j = 0; j <= x; j++) dp[i][j] = 1;
    }
    if (i < n - 1) {
      for (int j = 1; j < N; j++) {
        dp[i][j] += dp[i][j - 1];
        dp[i][j] %= M;
      }
    }
  }
  printf("%lld\n", dp[n - 1][sum]);
  ;
}
