#include <bits/stdc++.h>
using namespace std;
int f[101][100001];
int n, m;
int a[101];
int s[100001];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i][0] = 1;
    s[0] = 1;
    for (int j = 1; j <= m; j++) {
      s[j] = ((long long)s[j - 1] + f[i - 1][j]) % 1000000007;
    }
    for (int j = 1; j <= m; j++) {
      if (a[i] >= j)
        f[i][j] = s[j];
      else
        f[i][j] = s[j] - s[j - a[i] - 1];
    }
  }
  printf("%d", f[n][m]);
}
