0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 02:58:47 +00:00
OI-codes/Codeforces/1697/A/A.cpp

38 lines
504 B
C++
Raw Normal View History

#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 105;
int t, n, m;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
cin >> n >> m;
int ans = 0;
for (int i = 1, x; i <= n; i++) {
cin >> x;
m -= x;
if (m < 0) {
ans += -m;
m = 0;
}
}
cout << ans << endl;
}
return 0;
}