#include <bits/stdc++.h>
using namespace std;
long long dp[3003][3003], arr[3003], ans, n, s;
long long f(long long pos, long long rem) {
  if (rem < 0) return 0;
  if (rem == 0) return n - pos + 1;
  if (pos == n) return 0;
  long long &ret = dp[pos][rem];
  if (ret != -1) return ret;
  long long x = f(pos + 1, rem);
  long long y = f(pos + 1, rem - arr[pos]);
  if (rem == s) ans += (pos + 1) * y;
  ans %= 1000000007;
  return ret = (x + y) % 1000000007;
}
int main() {
  scanf("%lld %lld", &n, &s);
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  memset(dp, -1, sizeof dp);
  f(0, s);
  printf("%lld\n", ans);
}
