#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  cin >> m >> n;
  int arr[m];
  for (int i = 0; i < m; i++) cin >> arr[i];
  long long int dp[m + 1][n + 1];
  for (int i = 0; i <= m; i++) {
    for (int j = 1; j <= n; j++) dp[i][j] = 0;
  }
  for (int i = 0; i <= m; i++) dp[i][0] = 1;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      int a = arr[i - 1];
      for (int z = 0; z <= a; z++) {
        if (j - z >= 0) dp[i][j] = (dp[i][j] + dp[i - 1][j - z]) % 1000000007;
      }
    }
  }
  cout << dp[m][n] % 1000000007;
  return 0;
}
