LearnPy Hub
← Arena
EasyRating 800

Ice Cream Queue

An ice cream seller starts with x packs. A carrier brings + d packs. A child asks - d packs and gets them if there are enough; otherwise the child leaves sad. Print packs left and the number of sad children.

Input

n and x, then n lines like '+ 5' or '- 10'.

Output

Two integers.

Sample 1

Input
5 7
+ 5
- 10
- 20
+ 40
- 20
Output
22 1

Sample 2

Input
1 0
- 1
Output
0 1
solution.py
Output appears here
Ice Cream Queue · Python Arena problem · LearnPy Hub