#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dp[110][100010];

int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  vector<int> sum(K+1,0);
  dp[1][0] = 1; sum[0] = 1;
  for (int i = 1; i <= a[0]; i++)
    dp[1][i] = 1;
  
  for (int i = 1; i <= m; i++)
    sum[i] = sum[i - 1] + dp[1][i];

  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= min(m,a[i-1]); j++) {
		dp[i][j]=(sum[j]-(j-1>=0?sum[j-1]?0)+mod)%mod;
    }
    sum[0] = dp[i][0];
    for (int j = 1; j <= m; j++) sum[j] = (sum[j - 1] + dp[i][j]) % mod;

  }
  cout << dp[n][m] << endl;
  return 0;
}