fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n,d,td = 0,sng; cin >> n >> d;
  6. vector<int> t(n);
  7. for(int i=0;i<n;i++){
  8. cin >> t[i];
  9. td += t[i];
  10. }
  11. sng = td;
  12. td += (n-1)*10;
  13. if(td > d) cout << "-1";
  14. else cout << (d - sng)/5;
  15. return 0;
  16. }
Success #stdin #stdout 0s 5276KB
stdin
3 30
2 2 1
stdout
5