#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int ways(vector<int> &arr,vector<vector<int> > &dp, int idx, int sum)
{
if(idx < 0)
return (sum == 0);
if(sum == 0)
return 1;
if(sum < 0)
return 0;
int &ans = dp[idx][sum];
if(ans != -1)
return ans;
if(sum >= arr[idx])
ans = (ways(arr, dp, idx, sum - arr[idx]) + ways(arr, dp, idx - 1, sum)) % mod;
else
ans = ways(arr, dp, idx - 1, sum);
return ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int n, val;
cin >> n >> val;
vector<int> arr(n);
for(int i = 0; i < n; i++)
cin >> arr[i];
vector<vector<int> > dp(n, vector<int>(val + 1, -1));
cout << ways(arr, dp, n - 1, val);
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKCmNvbnN0IGludCBtb2QgPSAxZTkgKyA3OwogCmludCB3YXlzKHZlY3RvcjxpbnQ+ICZhcnIsdmVjdG9yPHZlY3RvcjxpbnQ+ID4gJmRwLCBpbnQgaWR4LCBpbnQgc3VtKQp7CiAgIGlmKGlkeCA8IDApCiAgICAgcmV0dXJuIChzdW0gPT0gMCk7CiAgIGlmKHN1bSA9PSAwKQogICAgICByZXR1cm4gMTsKICAgaWYoc3VtIDwgMCkKICAgICAgcmV0dXJuIDA7CiAgIAogICBpbnQgJmFucyA9IGRwW2lkeF1bc3VtXTsKICAgaWYoYW5zICE9IC0xKQogICAgICByZXR1cm4gYW5zOwogCiAgIGlmKHN1bSA+PSBhcnJbaWR4XSkKICAgICBhbnMgPSAod2F5cyhhcnIsIGRwLCBpZHgsIHN1bSAtIGFycltpZHhdKSArICB3YXlzKGFyciwgZHAsIGlkeCAtIDEsIHN1bSkpICUgbW9kOwogICBlbHNlCiAgICAgYW5zID0gd2F5cyhhcnIs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