#include <bits/stdc++.h>
using namespace std;
int dp[100][100001];
int a[100];
int main() {
  int N;
  int K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < K + 1; i++) {
    if (i <= a[0]) {
      dp[0][i] = 1;
    } else {
      dp[0][i] = 0;
    }
  }
  for (int i = 1; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < K + 1; j++) {
      sum = (sum + dp[i - 1][j]) % 1000000007;
      if (j - a[i] > 0) {
        if (sum - dp[i - 1][j - a[i] - 1] < 0) {
          sum = 1000000007 + (sum - dp[i - 1][j - a[i] - 1]) % 1000000007;
        } else {
          sum = (sum - dp[i - 1][j - a[i] - 1]) % 1000000007;
        }
      }
      dp[i][j] = sum;
    }
  }
  cout << dp[N - 1][K] << endl;
  cout << -1 % 5 << endl;
  return 0;
}
