fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int mod=1e9+7;
  4. long long arr[10000],dp[10050],n,m;
  5. int main() {
  6. ios::sync_with_stdio(false);
  7. cin.tie(0),cout.tie(0);
  8. cin>>n>>m;
  9. for(int i=1;i<=n;i++){
  10. cin>>arr[i];
  11. }
  12. dp[0]=1;
  13. for(int i=1;i<=m;i++){
  14. for(int j=1;j<=n;j++){
  15. if(i<arr[j]){
  16. continue;
  17. }
  18. dp[i]=(dp[i-arr[j]]+dp[i])%mod;
  19. }
  20. }
  21. cout<<dp[m]/(m-n-5);
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5288KB
stdin
6 15
1 5 10 20 50 100
stdout
10