#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e18;
const long long minN = -1e18;
const long long MOD = 1e9 + 7;
const long long MOD1 = 998244353;
const int baseHash = 331;
const int bigNumLength = 5000;
const long double PI = acos(-1);
const long long limit = 2e5 + 5;
const long long limit1 = 1e6 + 5;
const long long limit2 = 1e3 + 5;
pair<int, int> dir[] = {{0, 1}, {1, 0},  {0, -1}, {-1, 0},
                        {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
pair<int, int> NON = {-1, -1};
int n, k;
int a[limit];
int f[105][100005];
void solveProblem() {
  f[0][0] = 1;
  for (int i = (1); i <= (n); ++i) {
    int pre = 0;
    for (int j = (0); j <= (k); ++j) {
      pre += f[i - 1][j], pre %= MOD;
      if (j > a[i]) pre -= f[i - 1][j - a[i]];
      pre = (pre % MOD + MOD) % MOD;
      f[i][j] = pre;
    }
  }
  cout << f[n][k] << '\n';
}
void fastInput() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void readInput() {
  cin >> n >> k;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
}
int main() {
  fastInput();
  readInput();
  solveProblem();
}
