#include <bits/stdc++.h>
using namespace std;
void add_self(int& a, int b) {
  a += b;
  if (a >= 1e9 + 7) a -= 1e9 + 7;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  vector<int> dp(k + 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int candies = k; candies >= 0; candies--) {
      for (int x = 1; x <= min(a[i], k - candies); x++) {
        add_self(dp[candies + x], dp[candies]);
      }
    }
  }
  printf("%d", dp[k]);
  return 0;
}
