#include <bits/stdc++.h>
using namespace std;
const int sz = 3e3 + 9;
int n, k;
int a[sz];
int dp[sz][sz][2][2];
int m = 1e9 + 7;
int add(int a, int b) { return (a % m + b % m) % m; }
int mul(int a, int b) { return (a % m * b % m) % m; }
int solve(int idx, int rem, int st, int en) {
  int &ret = dp[idx][rem][st][en];
  if (~ret) return ret;
  if (st && en) {
    return !rem;
  }
  if (!idx) return 0;
  ret = solve(idx - 1, rem, st, en);
  if (!en) {
    ret = add(ret, solve(idx - 1, rem, st, 1));
    if (a[idx] <= rem) ret = add(ret, solve(idx - 1, rem - a[idx], st, 1));
  } else {
    ret = add(ret, solve(idx - 1, rem, 1, 1));
    if (a[idx] <= rem) {
      ret = add(ret, solve(idx - 1, rem - a[idx], st, en));
      ret = add(ret, solve(idx - 1, rem - a[idx], 1, en));
    }
  }
  return ret;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(n, k, 0, 0);
  return 0;
}
