#include <bits/stdc++.h>
using namespace std;
int n, k, t;
long long arr[100005], pre[100005];
const int mod = 1000000007;
int main() {
  scanf("%d%d", &n, &k);
  arr[0] = 1;
  for (int x = 0; x <= k; x++) pre[x] = 1;
  for (int x = 0; x < n; x++) {
    scanf("%d", &t);
    t += 1;
    for (int x = 0; x <= k; x++) {
      arr[x] = pre[x];
      if (x >= t) arr[x] -= pre[x - t];
      arr[x] %= mod;
      if (arr[x] < mod) arr[x] += mod;
    }
    for (int x = 1; x <= k; x++) pre[x] = (pre[x - 1] + arr[x]) % mod;
  }
  printf("%d\n", arr[k]);
}
