Saleh127

Untitled

Apr 20th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. int a,b,c[100000],d=0,e,f,i,j,k,l;
  7. cin>>a>>b;
  8. for(i=0;i<b;i++)
  9. {
  10. cin>>c[i];
  11. d+=c[i];
  12. }
  13. if(d>a) cout<<-1<<endl;
  14. else cout<<a-d<<endl;
  15. return 0;
  16.  
  17. }
Add Comment
Please, Sign In to add comment