#include <bits/stdc++.h>
using namespace std;
typedef long long arr[107];
typedef vector<long long> graph[107];
typedef pair<long long, long long> parr[107];
typedef long long table[107][100007];
typedef long long arr2[100007];
struct pp {
  long long a, b;
  bool operator<(const pp& V) const {
    if (a == V.a) return b < V.b;
    return a < V.a;
  }
  bool operator==(const pp& V) const {
    if (a == V.a && b == V.b) return 1;
    return 0;
  }
};
long long n, k, D[107][100007], sum[107][100007];
arr A;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 0; i <= k; i++) {
    if (i <= A[1]) D[1][i] = 1;
    sum[1][i] = sum[1][i - 1] + D[1][i];
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      D[i][j] = sum[i - 1][j];
      if (j >= A[i] + 1) D[i][j] -= sum[i - 1][j - A[i] - 1];
      D[i][j] %= 1000000007;
      sum[i][j] = sum[i][j - 1] + D[i][j];
      if (j == 0) sum[i][j] -= sum[i][j - 1] % 1000000007;
      sum[i][j] %= 1000000007 * 2;
    }
  }
  cout << D[n][k] << endl;
}
