After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.

At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the queue wants either to take several ice cream packs for himself and his friends or to give several ice cream packs to Kay and Gerda (carriers that bring ice cream have to stand in the same queue).

If a carrier with d ice cream packs comes to the house, then Kay and Gerda take all his packs. If a child who wants to take d ice cream packs comes to the house, then Kay and Gerda will give him d packs if they have enough ice cream, otherwise the child will get no ice cream at all and will leave in distress.

Kay wants to find the amount of ice cream they will have after all people will leave from the queue, and Gerda wants to find the number of distressed kids.


-----Input-----

The first line contains two space-separated integers n and x (1 ≤ n ≤ 1000, 0 ≤ x ≤ 10^9).

Each of the next n lines contains a character '+' or '-', and an integer d_{i}, separated by a space (1 ≤ d_{i} ≤ 10^9). Record "+ d_{i}" in i-th line means that a carrier with d_{i} ice cream packs occupies i-th place from the start of the queue, and record "- d_{i}" means that a child who wants to take d_{i} packs stands in i-th place.


-----Output-----

Print two space-separated integers — number of ice cream packs left after all operations, and number of kids that left the house in distress.


-----Examples-----
Input
5 7
+ 5
- 10
- 20
+ 40
- 20

Output
22 1

Input
5 17
- 16
- 2
- 98
+ 100
- 98

Output
3 2



-----Note-----

Consider the first sample.  Initially Kay and Gerda have 7 packs of ice cream.  Carrier brings 5 more, so now they have 12 packs.  A kid asks for 10 packs and receives them. There are only 2 packs remaining.  Another kid asks for 20 packs. Kay and Gerda do not have them, so the kid goes away distressed.  Carrier bring 40 packs, now Kay and Gerda have 42 packs.  Kid asks for 20 packs and receives them. There are 22 packs remaining.

Difficulty: EASY

Solutions:
(n, x) = map(int, input().split())
d = 0
for _ in range(n):
	(op, val) = input().split()
	val = int(val)
	if op == '-' and x < int(val):
		d += 1
		continue
	x += int(val) if op == '+' else -int(val)
print(x, d)


from sys import stdin
(n, x) = map(int, stdin.readline().rstrip().split(' '))
sold = distress = 0
for _ in range(n):
	(sign, amount) = stdin.readline().rstrip().split(' ')
	amount = int(amount)
	if sign == '+':
		x += amount
	elif amount > x:
		distress += 1
	else:
		x -= amount
print(x, distress)


(n, x) = map(int, input().split())
ch = 0
for _ in range(n):
	(a, b) = input().split()
	if a == '+':
		x += int(b)
	elif a == '-':
		if x < int(b):
			ch += 1
		else:
			x -= int(b)
print(x, ch)


string = input()
numbers = string.split(' ')
a = int(numbers[0])
b = int(numbers[1])
d = 0
for x in range(a):
	n = input()
	n = n.replace(' ', '')
	n = int(n)
	if b + n < 0:
		d += 1
	else:
		b += n
print('%d %d' % (b, d))


(n, x) = [int(x) for x in input('').split()]
ans = 0
while n > 0:
	n -= 1
	line = input('').split()
	if line[0] == '+':
		x += int(line[1])
	elif line[0] == '-':
		if x >= int(line[1]):
			x -= int(line[1])
		else:
			ans += 1
print(x, ans)


numbers = [int(i) for i in input().split()]
length = numbers[0]
start = numbers[1]
count = 0
for x in range(length):
	list1 = [i for i in input().split()]
	if list1[0] == '+':
		start += int(list1[1])
	elif start - int(list1[1]) >= 0:
		start -= int(list1[1])
	else:
		count += 1
print(start, count)


import re
n = list(map(int, input().split()))
a = n[0]
b = n[1]
count = 0
for i in range(a):
	s = str(input())
	x = list(map(int, re.findall('\\d+', s)))
	if s[0] == '+':
		b += x[0]
	elif s[0] == '-' and x[0] <= b:
		b -= x[0]
	else:
		count += 1
print(b, count)


(n, x) = map(int, input().split())
nm = 0
for i in range(n):
	(a, b) = map(str, input().split())
	if a == '+':
		x += int(b)
	else:
		b = int(b)
		if x >= b:
			x -= b
		else:
			nm += 1
print(x, nm)


[n, x] = [int(x) for x in input().split()]
c = 0
for i in range(n):
	o = input()
	if o[0] == '+':
		x += int(o.replace('+ ', ''))
	elif x < int(o.replace('- ', '')):
		c += 1
	else:
		x -= int(o.replace('- ', ''))
print(x, c)


(n, x) = map(int, input().split())
ls = [list(map(str, input().split())) for _ in range(n)]
y = 0
for di in ls:
	if di[0] == '+':
		x += int(di[1])
	elif di[0] == '-':
		if x >= int(di[1]):
			x -= int(di[1])
		elif x < int(di[1]):
			y += 1
print(x, y)


__author__ = 'aste'

def main():
	(n, x) = [int(i) for i in input().split()]
	res = x
	distressed = 0
	for i in range(0, n):
		(a, b) = input().split()
		if a == '-':
			b = -int(b)
		else:
			b = int(b)
		if b >= 0:
			res += b
		elif -b > res:
			distressed += 1
		else:
			res += b
	print(res, distressed, end=' ')
main()


(n, x) = input().split(' ')
X = []
for i in range(int(n)):
	X.append(input().split(' '))

def out(X, x):
	r = int(x)
	m = 0
	for j in X:
		if j[0] == '+':
			r = r + int(j[1])
		if j[0] == '-':
			if r >= int(j[1]):
				r = r - int(j[1])
			else:
				m = m + 1
	print(r, m)
out(X, x)


(n, x) = map(int, input().split())
ans = 0
for _ in range(n):
	(pm, d) = input().split()
	d = int(d)
	if pm == '+':
		x += d
	elif x < d:
		ans += 1
	else:
		x -= d
print(x, ans)


(n, x) = map(int, input().split())
l = [list(input().split()) for _ in range(n)]
c = 0
for i in range(n):
	if l[i][0] == '+':
		x = x + int(l[i][1])
	elif x >= int(l[i][1]):
		x = x - int(l[i][1])
	else:
		c = c + 1
print(x, c)


(n, x) = list(map(int, input().split()))
cur = x
sad = 0
for i in range(n):
	(c, m) = input().split()
	m = int(m)
	if c == '+':
		cur += m
	elif cur >= m:
		cur -= m
	else:
		sad += 1
print(cur, sad)


x = list(map(int, input().split()))
z = []
for i in range(x[0]):
	y = input().split()
	z.append(y)
c = x[1]
count = 0
for j in range(x[0]):
	queue = int(z[j][0] + z[j][1])
	if queue > 0:
		c = c + queue
	elif c < abs(queue):
		count += 1
	else:
		c = c + queue
print(c, count)


(n, x) = (int(v) for v in input().split())
dis = 0
for _ in range(n):
	(op, d) = input().split()
	if op == '+':
		x += int(d)
	elif int(d) <= x:
		x -= int(d)
	else:
		dis += 1
print(x, dis)


(n, x) = map(int, input().split())
d = 0
for i in range(n):
	(s, v) = input().split()
	if s == '+':
		x += int(v)
	elif int(v) > x:
		d += 1
	else:
		x -= int(v)
print(str(x) + ' ' + str(d))


(n, x) = map(int, input().split())
k = 0
for i in range(n):
	a = input().split()
	z = int(a[1])
	if a[0] == '+':
		x += z
	elif z > x:
		k += 1
	else:
		x -= z
print(x, k)


(n, x) = map(int, input().split())
s = 0
for i in range(n):
	(k, l) = map(str, input().split())
	if k == '+':
		x += int(l)
	elif int(l) <= x:
		x -= int(l)
	else:
		s += 1
print(x, s)


(n, x) = input().split()
n = int(n)
x = int(x)
sum = x
left = 0
for i in range(n):
	(a, b) = input().split()
	if a == '-' and sum - int(b) < 0:
		left += 1
	elif a == '+':
		sum += int(b)
	elif a == '-' and sum - int(b) >= 0:
		sum -= int(b)
print(sum, end=' ')
print(left)


(imp, packs) = input().split()
imp = int(imp)
packs = int(packs)
dist = 0
for i in range(imp):
	(buy, value) = input().split()
	value = int(value)
	if buy == '+':
		packs += value
	elif buy == '-':
		if packs >= value:
			packs -= value
		else:
			dist += 1
print(packs, dist)


(n, x) = map(int, input().split())
sad_ch = 0
for i in range(n):
	s = input()
	if s[0] == '+':
		x += int(s[2:])
	elif s[0] == '-' and int(s[2:]) > x:
		sad_ch += 1
	elif s[0] == '-' and int(s[2:]) <= x:
		x -= int(s[2:])
print(x, sad_ch)


s = input()
k = s.find(' ')
n = int(s[0:k])
x = int(s[k + 1:])
fu = 0
while n > 0:
	d = input()
	if d[0] == '+':
		x += int(d[2:])
	elif x >= int(d[2:]):
		x -= int(d[2:])
	else:
		fu += 1
	n -= 1
print(x, fu)


(a, b) = map(int, input().split())
distress = 0
for i in range(a):
	c = input().split()
	aux = int(c[1])
	if c[0] == '+':
		b = b + aux
	elif aux <= b:
		b = b - aux
	else:
		distress = distress + 1
print(b, distress)


(n, x) = map(int, input().split())
distress = 0
for _ in range(n):
	(need, cream) = map(str, input().split())
	if need == '+':
		x += int(cream)
	elif need == '-':
		if x - int(cream) >= 0:
			x -= int(cream)
		else:
			distress += 1
print(x, distress)


(n, x) = map(int, input().split())
distress = 0
for i in range(n):
	(sign, value) = input().split()
	if sign == '+':
		x += int(value)
	elif x >= int(value):
		x -= int(value)
	else:
		distress += 1
print(x, distress)


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	st = input()
	if st[0] == '+':
		x += int(st[2:])
	elif x < int(st[2:]):
		count += 1
	else:
		x -= int(st[2:])
print(x, count)


li = [int(i) for i in input().split()]
n = li[0]
x = li[1]
c = 0
while n:
	li1 = [i for i in input().split()]
	ch = li1[0]
	m = int(li1[1])
	if ch == '+':
		x += m
	elif ch == '-':
		if x < m:
			c += 1
		else:
			x -= m
	n -= 1
print(x, c)


(n, x) = map(int, input().split())
n_sad = 0
for _ in range(n):
	(t, sc) = input().split()
	c = int(sc)
	if t == '+':
		x += c
	elif x >= c:
		x -= c
	else:
		n_sad += 1
print(x, n_sad)


input1 = input()
first = int(input1.split()[0])
second = int(input1.split()[1])
distress = 0
for i in range(0, first):
	input2 = input()
	symbol = input2.split()[0]
	value = int(input2.split()[1])
	if symbol == '+':
		second = second + value
	elif second - value >= 0:
		second = second - value
	else:
		distress = distress + 1
print(str(second) + ' ' + str(distress))


(n, x) = map(int, input().split())
c = 0
for _ in range(n):
	a = input()
	if a[0] == '+':
		x += int(a[2:])
	elif x < int(a[2:]):
		c += 1
	else:
		x -= int(a[2:])
print(x, c)


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	(d, e) = input().split()
	if d == '+':
		x += int(e)
	elif x < int(e):
		count += 1
	else:
		x -= int(e)
print(x, count)


(n, x) = [int(a) for a in input().split()]
distressed = 0
for i in range(n):
	tokens = input().split()
	y = int(tokens[1])
	if tokens[0] == '+':
		x += y
	elif x < y:
		distressed += 1
	else:
		x -= y
print(x, distressed)


(n, packs) = map(int, input().split())
(t, u) = (packs, 0)
(h, k) = (0, 0)
for i in range(n):
	(elec, PacksNeeded) = map(str, input().split())
	k = int(PacksNeeded)
	if elec == '+':
		t = t + k
	elif elec == '-':
		t = t - k
		if t < 0:
			t = t + k
			u = u + 1
print(t, u, sep=' ')


s = input()
s = s.split()
n = int(s[0])
res = int(s[1])
w = 0
for i in range(n):
	s2 = input()
	s2 = s2.split()
	sign = s2[0]
	num = int(s2[1])
	if sign == '+':
		res += num
	elif res - num >= 0:
		res -= num
	else:
		w += 1
print(res, w)


(n, m) = map(int, input().split(' '))
res = 0
for i in range(n):
	(s, k) = list(input().split(' '))
	k = int(k)
	if s == '+':
		m += k
	elif k <= m:
		m -= k
	else:
		res += 1
print(m, res)


(n, m) = map(int, input().split())
d = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		m += b
	if a == '-':
		if m < b:
			d += 1
		else:
			m = m - b
print(m, d)


(a, t) = map(int, input().split())
s = t
ctr = 0
for i in range(a):
	(k, r) = input().split()
	if k == '+':
		s += int(r)
	elif k == '-' and s - int(r) >= 0:
		s -= int(r)
	elif k == '-' and s - int(r) < 0:
		ctr += 1
print(s, ctr, end=' ')


(n, ice) = map(int, input().split())
d = 0
for x in range(n):
	(c, t) = input().split()
	t = int(t)
	if c == '+':
		ice += t
	elif t > ice:
		d += 1
	else:
		ice -= t
print(ice, d)


(n, x) = [int(i) for i in input().split()]
dis = 0
for _ in range(n):
	arr = [i for i in input().split()]
	if arr[0] == '+':
		x = x + int(arr[1])
	if arr[0] == '-' and x < int(arr[1]):
		dis = dis + 1
	if arr[0] == '-' and x >= int(arr[1]):
		x = x - int(arr[1])
print(x, dis)


n = list(map(int, input().split()))
ic = n[1]
kid = 0
store = []
for i in range(n[0]):
	t = list(input().split())
	store.append(t)
for i in store:
	if i[0] == '-':
		if int(i[1]) <= ic:
			ic -= int(i[1])
		else:
			kid += 1
	else:
		ic += int(i[1])
print(str(ic) + ' ' + str(kid))


(n, x) = map(int, input().split())
(sum, d) = (x, 0)
for i in range(n):
	(a, b) = input().split()
	if a == '+':
		sum += int(b)
	elif sum >= int(b):
		sum -= int(b)
	else:
		d += 1
print(sum, d)


(n, x) = input().split()
(n, x) = (int(n), int(x))
count = 0
for _ in range(n):
	(sign, ic) = input().split()
	ic = int(ic)
	if sign == '+':
		x += ic
	elif sign == '-':
		if x < ic:
			count += 1
		else:
			x -= ic
print(x, count)


number_of_queue_and_number_of_ice_cream = list(map(int, input().split()))
total_ice_cream = number_of_queue_and_number_of_ice_cream[1]
queue = list()
number_of_distress_kids = 0
for i in range(number_of_queue_and_number_of_ice_cream[0]):
	carrier = input().split()
	sign = carrier[0]
	number = int(carrier[1])
	time = (sign, number)
	queue.append(time)
j = 0
while j < len(queue):
	if queue[j][0] == '+':
		total_ice_cream += queue[j][1]
	elif total_ice_cream >= queue[j][1]:
		total_ice_cream -= queue[j][1]
	else:
		number_of_distress_kids += 1
	j += 1
print(total_ice_cream, number_of_distress_kids)


(n, x) = list(map(int, input().split()))
(k, g) = (x, 0)
for _ in range(n):
	(a, b) = list(map(str, input().split()))
	b = int(b)
	if a == '+':
		k += b
	elif k >= b:
		k -= b
	else:
		g += 1
print(k, end=' ')
print(g)


(n, x) = list(map(int, input().split()))
a = []
for i in range(n):
	(s, d) = input().split()
	if s == '-':
		a.append(-int(d))
	else:
		a.append(int(d))
d = 0
for i in a:
	if i < 0:
		if x >= abs(i):
			x -= abs(i)
		else:
			d += 1
	else:
		x += i
print(x, d)


(n, x) = map(int, input().split())
c = 0
for i in range(n):
	(*a,) = input()
	a = list(a)
	if '+' in a:
		del a[:2]
		s = ''
		for i in a:
			s += i
		x += int(s)
	elif '-' in a:
		del a[:2]
		s = ''
		for i in a:
			s += i
		if int(s) > x:
			c += 1
		else:
			x -= int(s)
print(x, c)


(n, m) = list(map(int, input().strip().split()))
t = 0
for i in range(n):
	l = input().split()
	if l[0] == '+':
		m = m + int(l[1])
	elif l[0] == '-':
		if m < int(l[1]):
			t += 1
		else:
			m = m - int(l[1])
print(m, t)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
f = 0
sum = 0
s = b
e = 0
for i in range(a):
	(c, d) = input().split(' ')
	d = int(d)
	if c == '+':
		s += d
	elif s - d < 0:
		f += 1
	else:
		s = s - d
print(s, f)


(n, x) = [int(x) for x in input().split()]
distress = 0
for _ in range(n):
	temp = x
	x += eval(input())
	if x < 0:
		distress += 1
		x = temp
print(x, distress)


(n, x) = list(map(int, input().split()))
d = 0
for i in range(n):
	(s, t) = input().split()
	t = int(t)
	if s == '+':
		x += t
	elif x >= t:
		x -= t
	else:
		d += 1
print(x, d)


def icecream(n, x):
	count = 0
	for i in range(0, n):
		st = list(input().split())
		s = st[0]
		t = int(st[1])
		if s == '+':
			x = x + t
		elif x < t:
			count = count + 1
		else:
			x = x - t
	print(x, count)
list1 = [int(i) for i in input().split()]
icecream(list1[0], list1[1])


(n, x) = input().split()
n = int(n)
x = int(x)
dchild = 0
for i in range(n):
	str = ''
	(str, c) = input().split()
	c = int(c)
	if str == '+':
		x = x + c
	elif x < c:
		dchild += 1
	else:
		x = x - c
print(x, dchild, sep=' ')


(n, x) = map(int, input().split())
ans = 0
for i in range(n):
	s = input()
	d = int(s[2:])
	if s[0] == '+':
		x += d
	elif x < d:
		ans += 1
	else:
		x -= d
print(x, ans)


(line, stock) = tuple(map(lambda e: int(e), input().split(' ')))
sad_kids = 0
for i in range(0, line):
	(sign, amount) = tuple(input().split(' '))
	amount = int(amount)
	if sign == '+':
		stock += amount
	elif stock - amount < 0:
		sad_kids += 1
	else:
		stock = stock - amount
print('{} {}'.format(stock, sad_kids))


contents = []
total = 0
counter = 0
while True:
	try:
		contents.append(input().split())
	except:
		break
total = int(contents[0][1])
faliure = 0
for i in range(int(contents[0][0])):
	sign = contents[i + 1][0]
	number = int(contents[i + 1][1])
	if sign == '+':
		total += number
	elif total - number >= 0:
		total -= number
	else:
		faliure += 1
print(total, faliure)


read = lambda : map(int, input().split())
(n, x) = read()
cnt = 0
for i in range(n):
	(t, d) = input().split()
	d = int(d)
	if t == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		cnt += 1
print(x, cnt)


(n, k) = map(int, input().split())
dis = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		k += b
	elif b <= k:
		k -= b
	else:
		dis += 1
print(f'{k} {dis}')


(n, x) = (int(i) for i in input().split())
dis = 0
for i in range(n):
	(s, d) = (j for j in input().split())
	if s == '+':
		x += int(d)
	elif x < int(d):
		dis += 1
	else:
		x -= int(d)
print(x, dis)


(k, x) = map(int, input().split())
(taken, given, count) = (x, 0, 0)
for i in range(k):
	l = list(input().split())
	if l[0] == '+':
		taken += int(l[1])
	elif l[0] == '-' and taken >= int(l[1]):
		taken = taken - int(l[1])
	else:
		count += 1
print(taken, count)


(num_people, num_icecream) = map(int, input().split())
distressed = 0
for i in range(num_people):
	(sign, quantity) = input().split()
	quantity = int(quantity)
	if sign == '+':
		num_icecream += quantity
	elif num_icecream < quantity:
		distressed += 1
	else:
		num_icecream -= quantity
print(num_icecream, distressed)


import sys
(n, x) = map(int, input().split())
sad = 0
for i in range(n):
	(a, b) = map(str, input().split())
	b = int(b)
	if a == '+':
		x += b
	elif x >= b:
		x -= b
	else:
		sad += 1
print(x, sad)


[n, x] = list(map(int, input().split()))
dis = 0
for i in range(n):
	[mode, y] = list(map(str, input().split()))
	y = int(y)
	if mode == '+':
		x += y
	elif mode == '-':
		if y > x:
			dis += 1
		else:
			x -= y
print(x, dis)


(n, x) = input().split()
n = int(n)
x = int(x)
c = 0
for i in range(1, n + 1):
	(a, d) = input().split()
	d = int(d)
	if a == '+':
		x += d
	elif a == '-':
		if x >= d:
			x -= d
		else:
			c += 1
print(x, c, sep=' ')


(n, x) = map(int, input().split())
distress = 0
ices = x
for _ in range(n):
	s = input()
	if s[0] == '+':
		ices += int(s[2:])
	elif ices >= int(s[2:]):
		ices -= int(s[2:])
	else:
		distress += 1
print('{} {}'.format(ices, distress))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
(n, ic) = get_list()
queue = [sys.stdin.readline().strip().split() for _ in range(n)]
queue = [[lst[0], int(lst[1])] for lst in queue]
distressed = 0
for lst in queue:
	if lst[0] == '+':
		ic += lst[1]
	elif ic >= lst[1]:
		ic -= lst[1]
	else:
		distressed += 1
print(ic, distressed)


(n, x) = [int(x) for x in input().split()]
dis = 0
for i in range(n):
	hey = input()
	num = (-2 * int(hey[0] == '-') + 1) * int(hey[2:])
	if x + num >= 0:
		x += num
	else:
		dis += 1
print(x, dis)


(n, x) = [int(s) for s in input().split()]
m = 0
for i in range(n):
	(a, d) = input().split()
	d = int(d)
	if a == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		m += 1
print(x, m)


(n, x) = list(map(int, input().split()))
bad = 0
for i in range(n):
	l = input().split()
	(cmd, d) = l
	d = int(d)
	if cmd == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		bad += 1
print(x, bad)


(m, n) = list(map(int, input().split()))
sum = n
count1 = 0
for i in range(m):
	(o, p) = input().split()
	if o == '+':
		sum = sum + int(p)
	elif int(p) <= sum:
		sum = sum - int(p)
	else:
		count1 = count1 + 1
print(sum, count1)


(m, n) = map(int, input().split())
c = 0
for i in range(m):
	(a, b) = map(str, input().split())
	if a == '+':
		n += int(b)
	elif a == '-' and n >= int(b):
		n -= int(b)
	else:
		c += 1
print(n, c)


x = list(map(int, input().split()))
count = 0
for i in range(0, x[0]):
	ch = list(map(str, input().split()))
	d = int(ch[1])
	if ch[0] == '+':
		x[1] += d
	elif d <= x[1]:
		x[1] -= d
	else:
		count += 1
print(f'{x[1]} {count}')


(n, l) = map(int, input().split())
tot = l
d = 0
for i in range(n):
	c = input().split()
	if c[0] == '+':
		tot += int(c[1])
	elif int(c[1]) <= tot:
		tot -= int(c[1])
	else:
		d += 1
print(tot, d)


(n, x) = map(int, input().split())
k = 0
a = [0] * n
for i in range(n):
	a[i] = [0] * 2
for i in range(0, n):
	(a[i][0], a[i][1]) = map(str, input().split())
for i in range(0, n):
	if a[i][0] == '+':
		x += int(a[i][1])
	else:
		x -= int(a[i][1])
		if x < 0:
			x += int(a[i][1])
			k += 1
print(x, k)


(n, x) = map(int, input().split(' '))
total = x
sad = 0
for i in range(0, n):
	(a, b) = input().split(' ')
	if a == '+':
		total = total + int(b)
	else:
		b = int(b)
		if b <= total:
			total = total - b
		else:
			sad = sad + 1
print(total, sad)


(n, x) = map(int, input().split())
g = 0
for _ in range(n):
	y = int(''.join(input().split()))
	if y >= 0:
		x += y
	else:
		y = -y
		if x >= y:
			x -= y
		else:
			g += 1
print(x, g)


(n, m) = [int(i) for i in input().split()]
k = 0
for _ in range(n):
	(a, b) = input().split()
	if a == '+':
		m += int(b)
	elif m - int(b) < 0:
		k += 1
	else:
		m -= int(b)
print(m, k)


(n, ic) = map(int, input().split())
cd = 0
while n:
	s = input()
	d = s[0]
	e = int(s[2:])
	if d == '+':
		ic += e
	elif ic >= e:
		ic -= e
	else:
		cd += 1
	n -= 1
print(ic, cd)


(n, x) = map(int, input().split())
count = x
dis = 0
for i in range(n):
	(c, d) = map(str, input().split())
	d = int(d)
	if c == '+':
		count += d
	elif d <= count:
		count -= d
	else:
		dis += 1
print(count, dis)


d = 0
(a, b) = map(int, input().split(' '))
ic = b
for i in range(a):
	(x, y) = map(str, input().split(' '))
	if x == '+':
		ic += int(y)
	elif int(y) > ic:
		d += 1
	else:
		ic -= int(y)
print(ic, d)


n = list(map(int, input().split()))
i = 1
c = 0
while i <= n[0]:
	a = input().split()
	if a[0] == '-' and int(a[1]) <= n[1]:
		n[1] -= int(a[1])
	elif a[0] == '-':
		c += 1
	else:
		n[1] += int(a[1])
	i += 1
print(n[1], c)


(people, pack_count) = map(int, input().split())
distressed = 0
for _ in range(people):
	(take_or_give, ice_count) = input().split()
	ice_count = int(ice_count)
	if take_or_give == '+':
		pack_count += ice_count
	elif ice_count <= pack_count:
		pack_count -= ice_count
	else:
		distressed += 1
print(pack_count, distressed)


(n, x) = (int(a) for a in input().split())
dis = 0
for i in range(n):
	(s, d) = input().split()
	d = int(d)
	if s == '+':
		x += d
	elif s == '-' and d <= x:
		x -= d
	elif s == '-' and d > x:
		dis += 1
print(x, dis)


(n, x) = map(int, input().split())
num_sad_kids = 0
for _ in range(n):
	(c, d) = input().split()
	d = int(d)
	if c == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		num_sad_kids += 1
print(x, num_sad_kids)


(n, x) = map(int, input().split())
cnt = 0
for i in range(n):
	(a, d) = map(str, input().split())
	if a == '+':
		x += int(d)
	elif x - int(d) >= 0:
		x -= int(d)
	else:
		cnt += 1
print(x, cnt)


(xx, x) = [int(i) for i in input().split()]
y = 0
for i in range(xx):
	z = input().split()
	if z[0] == '+':
		x += int(z[1])
	elif int(z[1]) > x:
		y += 1
	else:
		x -= int(z[1])
print(x, y)


(n, x) = map(int, input().split())
kids = 0
for i in range(n):
	(znak, d) = input().split()
	d = int(d)
	if znak == '+':
		x += d
	elif d <= x:
		x -= d
	else:
		kids += 1
print(x, kids)


(n, x) = list(map(int, input().split()))
sad = 0
for i in range(n):
	(do, amount) = input().split()
	if do == '+':
		x += int(amount)
	elif x >= int(amount):
		x -= int(amount)
	else:
		sad += 1
print(x, sad)


import sys
response = input()
response = response.split()
n = int(response[0])
x = int(response[1])
sad_child = 0
while n > 0:
	response = input()
	sign = response[0]
	number = int(response[2:])
	if sign == '+':
		x += number
	elif number <= x:
		x -= number
	else:
		sad_child += 1
	n -= 1
print(x, sad_child)
sys.stdout.flush()


(n, x) = map(int, input().split())
(y, d) = ([], 0)
for i in range(n):
	(a, b) = input().split()
	c = int(str(a) + str(b))
	y.append(c)
(p, output) = (0, 0)
for i in range(n):
	if x + y[i] >= 0:
		x += y[i]
	else:
		output += 1
print(x, output)


(n, x) = list(map(int, input().split()))
ice = x
distres = 0
for i in range(n):
	(s, a) = input().split()
	a = int(a)
	if s == '+':
		ice += a
	elif ice - a < 0:
		distres += 1
	else:
		ice -= a
print(ice, distres)


(n, x) = input().split()
(n, x) = (int(n), int(x))
children = []
for i in range(0, n):
	child = input().split()
	child[1] = int(child[1])
	children.append(child)
distressed = 0
for i in range(0, len(children)):
	if children[i][0] == '+':
		x += children[i][1]
	elif children[i][1] > x:
		distressed += 1
	else:
		x -= children[i][1]
print(x, distressed)


nx = input().strip().split(' ')
n = int(nx[0])
x = int(nx[1])
dist = 0
store = x
for i in range(n):
	ent = input().strip().split(' ')
	if ent[0] == '+':
		store += int(ent[1])
	elif store >= int(ent[1]):
		store -= int(ent[1])
	else:
		dist += 1
print(store, dist)


(p, q) = list(map(int, input().split()))
c = 0
t = 0
for i in range(p):
	(a, b) = list(input().split(' '))
	x = int(b)
	if a == '+':
		q = x + q
	elif a == '-':
		if q >= x:
			q = q - x
		else:
			c = c + 1
print(q, c)


(n, x) = map(int, input().split())
lines = [input() for _ in range(n)]
d: int = 0
for line in lines:
	(operator, o) = line.split()
	o = int(o)
	d += 1 if operator == '-' and x < o else 0
	x += o if operator == '+' else 0 if x < o else -o
print(x, d)


(n, m) = map(int, input().split())
(a, c) = ([], 0)
for i in range(0, n):
	(s, f) = input().split()
	f = int(f)
	a.append(s)
	a.append(f)
for i in range(0, len(a), +2):
	if a[i] == '+':
		m = m + a[i + 1]
	else:
		m = m - a[i + 1]
		if m < 0:
			c = c + 1
			m = m + a[i + 1]
print(m, c)


(n, k) = [int(x) for x in input().split()]
d = 0
for sdfdsf in range(n):
	s = [x for x in input().split()]
	o = s[0]
	c = int(s[1])
	if o == '-':
		if c > k:
			d += 1
		else:
			k -= c
	else:
		k += c
print(k, d)


(a, b) = map(int, input().split())
rez = 0
for i in range(a):
	(c, d) = input().split()
	if c == '+':
		b += int(d)
	else:
		d = int(d)
		if b >= d:
			b -= d
		else:
			rez += 1
print(b, rez)


(n, k) = map(int, input().split(' '))
ct = 0
for j in range(n):
	(p, num) = map(str, input().split(' '))
	if p == '+':
		k += int(num)
	elif k - int(num) < 0:
		ct += 1
	else:
		k -= int(num)
print(k, ct)


(n, ini) = map(int, input().split())
dis = 0
tot = ini
for i in range(n):
	(a, b) = map(str, input().split())
	if a == '+':
		tot += int(b)
	if a == '-':
		if tot >= int(b):
			tot -= int(b)
		else:
			dis += 1
print(tot, dis)


(n, x) = map(int, input().split())
amount = x
dist = 0
for _ in range(n):
	(m, a) = map(str, input().split())
	a = int(a)
	if m == '+':
		amount += a
	elif a <= amount:
		amount -= a
	else:
		dist += 1
print(amount, dist)


(n, x) = map(int, input().split())
dist = 0
for i in range(n):
	ls = list(input().split())
	if ls[0] == '+':
		x = x + int(ls[1])
	elif x >= int(ls[1]):
		x = x - int(ls[1])
	else:
		dist = dist + 1
print(x, dist, end=' ')


(n, x) = map(int, input().split())
d = 0
for _ in range(n):
	(s, p) = input().split()
	if s == '+':
		x += int(p)
	elif x - int(p) >= 0:
		x -= int(p)
	else:
		d += 1
print(x, d)


(n, ice) = map(int, input().split())
stressed = 0
for i in range(n):
	result = ice + eval(input())
	if result < 0:
		stressed += 1
	else:
		ice = result
print(ice, stressed)


def main():
	from sys import stdin, stdout
	(n, x) = map(int, stdin.readline().split())
	dis = 0
	for _ in range(n):
		(a, b) = stdin.readline().split()
		if a == '+':
			x += int(b)
		elif x < int(b):
			dis += 1
		else:
			x -= int(b)
	stdout.write(str(x) + ' ' + str(dis))
main()


(n, x) = map(int, input().split())
res = 0
for i in range(n):
	(c, d) = map(str, input().split())
	d = int(d)
	if c == '-':
		if d <= x:
			x -= d
		else:
			res += 1
	else:
		x += d
print(x, res)


(n, x) = list(map(int, input().split()))
r = 0
for _ in range(n):
	(c, p) = list(map(str, input().split()))
	if c == '+':
		x += int(p)
	elif x >= int(p):
		x -= int(p)
	else:
		r += 1
print(x, r)


def main():
	(n, x) = map(int, input().split())
	k = 0
	for _ in range(n):
		(c, d) = input().split()
		d = int(d)
		if c == '+':
			x += d
		elif d > x:
			k += 1
		else:
			x -= d
	print(f'{x} {k}')
main()


(n, x) = map(int, input().split())
m = 0
for case in range(n):
	d = int(''.join(input().split(' ')))
	if x + d < 0:
		m += 1
	else:
		x += d
print(x, m)


import math
import sys

def ri():
	return input()

def ii():
	return int(input())

def li():
	return input().split()

def mi():
	return list(map(int, input().split()))
(n, x) = mi()
d = 0
for i in range(n):
	line = ri().split()
	if line[0] == '+':
		x += int(line[1])
	elif x >= int(line[1]):
		x -= int(line[1])
	else:
		d += 1
print(x, d)


import sys
import math
import bisect

def main():
	(n, m) = map(int, input().split())
	cnt = 0
	for i in range(n):
		(a, b) = input().split()
		if a == '+':
			m += int(b)
		elif m < int(b):
			cnt += 1
		else:
			m -= int(b)
	print('%d %d' % (m, cnt))
main()


(n, total) = map(int, input().split())
no = 0
for i in range(n):
	(char, d) = input().split()
	d = int(d)
	if char == '+':
		total += d
	elif total < d:
		no += 1
	elif total >= d:
		total -= d
print(total, no)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(n, x) = invr()
m = 0
for i in range(n):
	s = input()
	a = int(s[2:])
	if s[0] == '+':
		x = x + a
	elif a > x:
		m = m + 1
	else:
		x = x - a
print(x, m)


[n, x] = map(int, input().split())
distress_mount = 0
for i in range(n):
	[j, k] = input().split()
	if j == '+':
		x += int(k)
	elif x < int(k):
		distress_mount += 1
	else:
		x -= int(k)
print(x, end=' ')
print(distress_mount)


(rows, started_ice) = map(int, input().split())
sad_child = 0
storage_ice = started_ice
for _ in range(rows):
	a = input()
	b = int(a[2:])
	if a[0] == '-':
		if storage_ice >= b:
			storage_ice -= b
		else:
			sad_child += 1
	else:
		storage_ice += b
print(storage_ice, sad_child)


(n, k) = map(int, input().split())
cnt = 0
for i in range(n):
	(c, x) = input().split()
	x = int(x)
	if c == '+':
		k += x
	elif k >= x:
		k -= x
	elif k < x:
		cnt += 1
print(k, cnt)


from sys import stdin, stdout

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(str(c))
(n, x) = get_ints()
d = 0
for i in range(n):
	s = get_string()
	a = int(s[2:])
	if s[0] == '+':
		x += a
	elif a <= x:
		x = x - a
	else:
		d += 1
print(x, d)


(m, n) = map(int, input().split())
count = 0
for _ in range(m):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		n = n + b
	elif a == '-':
		if n < b:
			count += 1
		else:
			n = n - b
print(n, count)


(a, b) = [int(x) for x in input().split()]
list = []
j = 0
count = 0
for i in range(a):
	h = input()
	list.append(h)
for i in list:
	i = i.replace(' ', '')
	list[j] = i
	j = j + 1
for i in range(a):
	if b + int(list[i]) >= 0:
		b = b + int(list[i])
	else:
		count = count + 1
print(b, count)


(n, m) = map(int, input().split(' '))
o = 0
for i in range(n):
	(d, s) = map(str, input().split(' '))
	if d == '+':
		m += int(s)
	elif d == '-':
		if m - int(s) >= 0:
			m -= int(s)
		else:
			o += 1
print(m, o)


I = [int(i) for i in input().split()]
(M, N) = ([], [])
for i in range(I[0]):
	k = [i for i in input().split()]
	M.append(k[0])
	N.append(k[1])
(s, count) = (I[1], 0)
for i in range(I[0]):
	if M[i] == '+':
		s += int(N[i])
	elif s < int(N[i]):
		count += 1
	else:
		s -= int(N[i])
print(s, count)


(n, k) = list(map(int, input().split()))
d = 0
for i in range(n):
	inp = input().split()
	eq = inp[0]
	s = int(inp[1])
	if eq == '+':
		k += s
	elif eq == '-':
		if k >= s:
			k -= s
		else:
			d += 1
print(k, d)


(n, m) = map(int, input().split())
c = 0
p = m
for i in range(n):
	s = list(input().split())
	if s[0] == '+':
		p = p + int(s[1])
	if s[0] == '-':
		if p >= int(s[1]):
			p = p - int(s[1])
		else:
			c = c + 1
print(p, c)


x = input()
x = x.split(' ')
val = int(x[1])
sad = 0
for i in range(int(x[0])):
	c = input()
	c = c.split(' ')
	if c[0] == '+':
		val = val + int(c[1])
	elif int(c[1]) > val:
		sad = sad + 1
	else:
		val = val - int(c[1])
print(str(val) + ' ' + str(sad))


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
(n, m) = q()
d = 0
for i in range(n):
	c = eval(''.join([f'{m}', input()]))
	if c >= 0:
		m = c
	else:
		d += 1
print(m, d)


count = 0
(a, b) = map(int, input().split())
while a > 0:
	a -= 1
	o = list(input().split())
	if o[0] == '+':
		b += int(o[1])
	elif o[0] == '-' and b >= int(o[1]):
		b -= int(o[1])
	else:
		count += 1
print(b, count)


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		x += b
	elif x >= b:
		x -= b
	else:
		count += 1
print(x, end=' ')
print(count)


(n, x) = [int(elem) for elem in input().split()]
(counter_ch, ost) = (0, x)
for i in range(n):
	s = input()
	(sign, value) = (s[0], int(s[2:]))
	if sign == '+':
		ost += value
	elif value > ost:
		counter_ch += 1
	else:
		ost -= value
print(ost, counter_ch)


(n, x) = map(int, input().split())
nope = 0
for loop in range(n):
	(signe, d) = input().split()
	d = int(d)
	if signe == '+':
		x += d
	elif x - d >= 0:
		x -= d
	else:
		nope += 1
print(x, nope)


num = list(map(int, input().split()))
n = num[0]
x = num[1]
dis = 0
for i in range(n):
	a = input()
	length = len(a)
	number = int(a[2:length])
	if a[0] == '+':
		x += number
	elif a[0] == '-' and x >= number:
		x -= number
	elif x < number:
		dis += 1
print(x, dis)


import sys
(n, x) = map(lambda x: int(x), sys.stdin.readline().split())
bad = 0
for i in range(n):
	(sym, num) = sys.stdin.readline().split()
	if sym == '+':
		x += int(num)
	elif x < int(num):
		bad += 1
	else:
		x -= int(num)
print(x, bad)


(n, x) = map(int, input().split())
dis = 0
for t in range(n):
	(sign, num) = input().split(maxsplit=1)
	if sign == '+':
		x += int(num)
	elif x >= int(num):
		x -= int(num)
	else:
		dis += 1
print(x, dis)


(n, x) = list(map(int, input().split()))
losser = 0
for i in range(n):
	(sign, packs) = input().split()
	if sign == '+':
		x += int(packs)
	elif sign == '-' and x >= int(packs):
		x -= int(packs)
	elif sign == '-' and x < int(packs):
		losser += 1
print(x, losser)


array = list(map(int, input().split()))
(n, x) = (array[0], array[1])
total = x
count = 0
for i in range(n):
	k = input()
	if k[0] == '+':
		k = int(k[1:])
		total = total + k
	else:
		k = int(k[1:])
		if k <= total:
			total = total - k
		else:
			count += 1
print(str(total) + ' ' + str(count))


(n, x) = [int(x) for x in input().split()]
pechal = 0
for i in range(n):
	(znak, cnt) = input().split()
	cnt = int(cnt)
	if znak == '+':
		x += cnt
	else:
		pechal += int(x < cnt)
		x -= int(x >= cnt) * cnt
print(x, pechal)


(x, y) = map(int, input().split())
count = y
c = 0
for i in range(x):
	(a, b) = input().split()
	if a == '+':
		count += int(b)
	elif count < int(b):
		c += 1
	else:
		count -= int(b)
print(count, c)


l1 = list(map(int, input().split(' ')))
ice = l1[1]
distress = 0
for i in range(l1[0]):
	l2 = list(map(str, input().split(' ')))
	if l2[0] == '+':
		ice = ice + int(l2[1])
	elif l2[0] == '-' and int(l2[1]) > ice:
		distress += 1
	elif l2[0] == '-' and int(l2[1]) <= ice:
		ice -= int(l2[1])
print(ice, distress)


(n, x) = map(int, input().split())
p = 0
for _ in range(n):
	m = input().split()
	if '-' in m and x - int(m[1]) >= 0:
		x = x - int(m[1])
	elif '+' in m:
		x = x + int(m[1])
	else:
		p += 1
print(x, p)


(n, x) = [int(i) for i in input().split()]
a = 0
for i in range(n):
	d = input().split()
	if d[0] == '+':
		x += int(d[1])
	if d[0] == '-':
		x -= int(d[1])
		if x < 0:
			x += int(d[1])
			a += 1
print(x, a)


(n, x) = map(int, input().split())
total = x
distressed = 0
for t in range(n):
	line = input().split()
	sign = line[0]
	number = int(line[1])
	if sign == '+':
		total += number
	elif total >= number:
		total -= number
	else:
		distressed += 1
print(str(total) + ' ' + str(distressed))


(n, x) = input().split()
(n, x) = (int(n), int(x))
c = 0
while n != 0:
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		x = x + b
	if a == '-' and b <= x:
		x = x - b
	elif a == '-' and b > x:
		c += 1
	n -= 1
print(x, c)


a = input()
b = a.split()
a = int(b[0])
b = int(b[1])
g = 0
for i in range(a):
	y = input()
	p = ''
	for i in range(2, len(y)):
		p = p + y[i]
	p = int(p)
	if y[0] == '+':
		b = b + p
	elif b - p >= 0:
		b = b - p
	else:
		g = g + 1
print(b, g)


(t, d) = map(int, input().split())
sum = d
c = 0
for i in range(t):
	(n, m) = map(str, input().split())
	if str(n) == '+':
		sum = sum + int(m)
	elif sum - int(m) < 0:
		c = c + 1
	else:
		sum = sum - int(m)
print(sum, c)


from sys import stdin
(n, x) = list(map(int, stdin.readline().split()))
res = 0
for _ in range(n):
	(a, d) = stdin.readline().split()
	d = int(d)
	if a == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		res += 1
print(x, res)


(x, y) = list(map(int, input().split(' ')))
z = []
for i in range(x):
	t = list(input().split(' '))
	z.append(t)
s = y
c = 0
for i in z:
	if i[0] == '+':
		s = s + int(i[1])
	elif int(i[1]) <= s:
		s = s - int(i[1])
	else:
		c = c + 1
print(str(s), str(c))


(O, P) = input().split(' ')
operations = []
for i in range(0, int(O)):
	X = input().split(' ')
	operations.append(X)
P = int(P)
count = 0
for j in operations:
	if j[0] == '+':
		P += int(j[1])
	if j[0] == '-':
		if P >= int(j[1]):
			P -= int(j[1])
		else:
			count += 1
print(P, count)


(n, I) = map(int, input().split())
count = 0
while n:
	(X, Y) = map(str, input().split())
	Y = int(Y)
	if X == '+':
		I = I + Y
	elif I - Y >= 0:
		I = I - Y
	else:
		count += 1
	n -= 1
print(I, count)


import math
(n, x) = [int(x) for x in input().split()]
currIceCreamPacks = x
totDistressed = 0
for i in range(n):
	words = input().split(' ')
	op = words[0]
	iceCreamUnits = int(words[1])
	if op == '+':
		currIceCreamPacks += iceCreamUnits
	elif currIceCreamPacks < iceCreamUnits:
		totDistressed += 1
	else:
		currIceCreamPacks -= iceCreamUnits
print(str(currIceCreamPacks) + ' ' + str(totDistressed))


def solve():
	(n, x) = [int(s) for s in input().split()]
	ans = 0
	for i in range(n):
		s = input().split()
		if s[0] == '+':
			x += int(s[1])
		elif x >= int(s[1]):
			x -= int(s[1])
		else:
			ans += 1
	print(x, ans)
solve()


(n, x) = map(int, input().split())
sad_kind = 0
for i in range(n):
	order = input().split()
	if order[0] == '+':
		x += int(order[1])
	elif x >= int(order[1]):
		x -= int(order[1])
	else:
		sad_kind += 1
print(x, sad_kind)


(n, x) = map(int, input().split())
distress = 0
for a in range(n):
	(take_or_give, how_much) = input().split()
	how_much = int(how_much)
	if take_or_give == '+':
		x += how_much
	if take_or_give == '-':
		if x >= how_much:
			x -= how_much
		else:
			distress += 1
print(x, distress)


(n, s) = map(int, input().split())
counter = 0
for i in range(n):
	(element, q) = map(str, input().split())
	if element == '+':
		s += int(q)
	elif s < int(q):
		counter += 1
	else:
		s -= int(q)
print(s, counter, sep=' ')


(n, x) = map(int, input().split())
lst = []
disChil = 0
for i in range(n):
	lst.append(list(input().split()))
for i in range(n):
	if lst[i][0] == '+':
		x += int(lst[i][1])
	elif x >= int(lst[i][1]):
		x -= int(lst[i][1])
	else:
		disChil += 1
print(x, disChil)


start = []
contents = []
count = 1
while True:
	try:
		line = input()
	except EOFError:
		break
	if count == 1:
		start.append(line.split())
		count = 0
	else:
		contents.append(line.split())
distressed = 0
index = int(start[0][0])
icecreamCount = int(start[0][1])
for i in range(0, index):
	sign = contents[i][0]
	val = int(contents[i][1])
	if sign == '-':
		if icecreamCount - val < 0:
			distressed += 1
			continue
		else:
			icecreamCount -= val
	if sign == '+':
		icecreamCount += val
print(icecreamCount, distressed)


(chel, mor) = map(int, input().split())
(ost, sad) = (mor, 0)
for i in range(chel):
	st = input()
	if st[0] == '+':
		ost += int(st[2:])
	else:
		now = int(st[2:])
		if ost >= now:
			ost -= now
		else:
			sad += 1
print(ost, sad)


(n, x) = map(int, input().split())
sad = 0
for _ in range(n):
	(sign, number) = input().split()
	number = int(number)
	if sign == '+':
		x += number
	elif number <= x:
		x -= number
	else:
		sad += 1
print(x, sad)


(n, x) = [int(i) for i in input().split()]
distressed = 0
for i in range(n):
	(plusminus, d) = input().split()
	d = int(d)
	if plusminus == '+':
		x += d
	elif d <= x:
		x -= d
	else:
		distressed += 1
print(x, distressed)


(n, k) = map(int, input().split())
x = 0
for i in range(n):
	(type, d) = input().split()
	d = int(d)
	if type == '+':
		k += d
	elif k < d:
		x += 1
	else:
		k -= d
print(k, x)


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	temp = input().split()
	(sgn, val) = (temp[0], int(temp[1]))
	if sgn == '+':
		x += val
	elif sgn == '-':
		if x >= val:
			x -= val
		else:
			count += 1
print(x, count)


(n, x) = list(map(int, input().split()))
d = 0
for i in range(n):
	(sign, val) = input().split()
	val = int(val)
	if sign == '+':
		x += val
	elif x >= val:
		x -= val
	else:
		d += 1
print(x, d)


(n, x) = map(int, input().split(' '))
c = 0
for i in range(n):
	(a, d) = map(str, input().split(' '))
	if a == '+':
		x = x + int(d)
	elif a == '-' and int(d) > x:
		c += 1
	elif a == '-' and int(d) <= x:
		x = x - int(d)
print(x, c, end=' ')


(n, x) = [int(x) for x in input().split(' ')]
d = 0
for i in range(n):
	(sign, am) = input().split(' ')
	am = int(am)
	if sign == '+':
		x += am
	elif x >= am:
		x -= am
	else:
		d += 1
print(x, d)


I = lambda : input().split()
(n, x) = map(int, I())
d = 0
for _ in range(n):
	l = list(I())
	if l[0] == '+':
		x += int(l[1])
	elif int(l[1]) <= x:
		x -= int(l[1])
	else:
		d += 1
print(x, d)


(n, x) = input(' ').split()
n = int(n)
x = int(x)
dis = 0
for i in range(0, n):
	(s, num) = input(' ').split()
	num = int(num)
	if s is '+':
		x += num
	if s is '-':
		if num > x:
			dis += 1
		else:
			x -= num
print(x, dis)


(n, d) = map(int, input().split())
sad = 0
for _ in range(n):
	s = input()
	(a, b) = s.split(' ')
	if a == '+':
		d += int(b)
	elif a == '-':
		if d < int(b):
			sad += 1
		else:
			d -= int(b)
print(d, sad)


(n, x) = map(int, input().split())
kid = 0
for i in range(n):
	x1 = input()
	if x1[0] == '+':
		x += int(x1[1:])
	elif x >= int(x1[1:]):
		x -= int(x1[1:])
	else:
		kid += 1
print(x, kid)


LINE1 = list(map(int, input('').split()))
distress = 0
ice = LINE1[1]
for i in range(LINE1[0]):
	a = input('')
	if a[0] == '-':
		if int(a[2:]) <= ice:
			ice = ice - int(a[2:])
		else:
			distress = distress + 1
	else:
		ice = ice + int(a[2:])
print(ice, distress)


import sys
input = sys.stdin.readline
import math

def inpit():
	return int(input())

def inplt():
	return list(map(int, input().split()))

def inpstr():
	s = input()
	return list(s[:len(s) - 1])

def inpspit():
	return map(int, input().split())
(n, d) = inpspit()
k = 0
for i in range(n):
	(f, t) = input().split()
	t = int(t)
	if f == '+':
		d = d + t
	elif f == '-' and t > d:
		k += 1
	else:
		d = d - t
print(d, k)


import sys
(n, x) = [int(num) for num in sys.stdin.readline()[:-1].split()]
distressed_child = 0
for i in range(n):
	(op, d) = sys.stdin.readline()[:-1].split()
	d = int(d)
	if op == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		distressed_child += 1
print(x, distressed_child)


import sys

def main():
	(n, x) = [int(x) for x in sys.stdin.readline().split()]
	distress = 0
	for i in range(n):
		(sign, d) = [y for y in sys.stdin.readline().split()]
		if sign is '+':
			x += int(d)
		else:
			ice = int(d)
			if x >= ice:
				x -= ice
			else:
				distress += 1
	print('{} {}'.format(x, distress))
main()


(n, x) = map(int, input().split())
d = 0
for _ in range(n):
	k = input()
	if '+' in k:
		x += int(k[2:])
	elif '-' in k:
		if x >= int(k[2:]):
			x -= int(k[2:])
		else:
			d += 1
print(x, d)


(n, x) = input().split()
(n, x) = (int(n), int(x))
s = 0
for i in range(n):
	(ch, num) = input().split()
	num = int(num)
	if ch == '+':
		x += num
	elif x < num:
		s += 1
	else:
		x -= num
print(x, s)


(n, x) = map(int, input().split())
c = 0
for i in range(n):
	(p, m) = input().split()
	m = int(m)
	if p == '+':
		x += m
	elif m > x:
		c += 1
	else:
		x -= m
print(x, c)


(n, x) = map(int, input().split())
L = [str(input()).split(' ') for _ in range(n)]
d = 0
for i in range(n):
	if L[i][0] == '+':
		x += int(L[i][1])
	elif int(L[i][1]) > x:
		d += 1
	else:
		x -= int(L[i][1])
print(str(x) + ' ' + str(d))


(n, ice) = (int(i) for i in input().split())
distress = 0
for i in range(n):
	(s, d) = (i for i in input().split())
	d = int(d)
	if s == '+':
		ice += d
	elif s == '-' and ice >= d:
		ice -= d
	else:
		distress += 1
print(ice, distress)


n = list(map(int, input().split()))
x = n[1]
runs = 0
dis = 0
while runs < n[0]:
	ic = list(input().split())
	if ic[0] == '+':
		x = x + int(ic[1])
	elif ic[0] == '-':
		if int(ic[1]) > x:
			dis += 1
		elif int(ic[1]) <= x:
			x = x - int(ic[1])
	runs += 1
print(str(x) + ' ' + str(dis))


m = list(map(int, input().split()))
n = m[0]
x = m[1]
d = 0
r = []
for i in range(n):
	h = input().split()
	if h[0] == '+':
		x += int(h[1])
	elif h[0] == '-':
		if x >= int(h[1]):
			x -= int(h[1])
		else:
			d += 1
print(x, d)


(n, x) = map(int, input().split())
dk = 0
for i in range(n):
	(s, k) = input().split()
	if s[0] == '+':
		x += int(k)
	elif s[0] == '-' and int(k) > x:
		dk += 1
	else:
		x -= int(k)
print(x, end=' ')
print(dk)


(n, x) = map(int, input().split())
su = 0
for i in range(0, n):
	ar = [m for m in input().split()]
	if ar[0] == '-':
		if x - int(ar[1]) >= 0:
			x -= int(ar[1])
		else:
			su += 1
	else:
		x += int(ar[1])
print(x, su)


(n, x) = [int(i) for i in input().split(' ')]
distress = 0
for i in range(n):
	query = input()
	if query[0] == '+':
		x += int(query[2:])
	elif query[0] == '-':
		if x - int(query[2:]) < 0:
			distress += 1
		else:
			x -= int(query[2:])
print(x, distress)


(n, x) = map(int, input().split())
sad = 0
for i in range(n):
	(sign, quantity) = input().split()
	quantity = int(quantity)
	if sign == '+':
		x += quantity
	elif sign == '-' and x < quantity:
		sad += 1
	else:
		x -= quantity
print(x, sad)


y = list(map(int, input().split()))
x = y[1]
res = 0
dist = 0
while res < y[0]:
	d = list(input().split())
	if d[0] == '+':
		x += int(d[1])
	elif d[0] == '-':
		if int(d[1]) > x:
			dist += 1
		elif int(d[1]) <= x:
			x -= int(d[1])
	res += 1
print(x, dist)


s = input()
i = s.find(' ')
n = int(s[:i])
x = int(s[i:])
g = 0
for i in range(n):
	s = input()
	ch = s[:1]
	d = int(s[2:])
	if ch == '-':
		if x < d:
			g += 1
		else:
			x -= d
	else:
		x += d
print('{} {}'.format(x, g))


(n, k) = map(int, input().split(' '))
dep = 0
for i in range(n):
	(op, a) = map(str, input().split(' '))
	a = int(a)
	if op == '+':
		k += a
	elif k - a < 0:
		dep += 1
	else:
		k -= a
print(str(k) + ' ' + str(dep))


import math, sys, re
(rs, ri, rai) = (input, lambda : int(input()), lambda : list(map(int, input().split())))
(n, x) = rai()
g = 0
for i in range(n):
	(ch, d) = input().split()
	d = int(d)
	if ch == '+':
		x += d
	elif d > x:
		g += 1
	else:
		x -= d
print(x, g)


l = list(map(int, input().split()))
stock = l[1]
dis = 0
for i in range(l[0]):
	n = list(map(str, input().split()))
	if n[0] == '+':
		stock += int(n[1])
	elif stock >= int(n[1]):
		stock -= int(n[1])
	else:
		dis += 1
print(stock, dis)


from __future__ import division, print_function
import math
import os
import sys
from sys import stdin, stdout
from io import BytesIO, IOBase
from collections import deque
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def main():
	(n, x) = map(int, input().split())
	cnt = 0
	for _ in range(n):
		(yn, ice) = map(str, input().split())
		if yn == '+':
			x += int(ice)
		else:
			x -= int(ice)
			if x < 0:
				cnt += 1
				x += int(ice)
	print(max(0, x), cnt)
main()


(a, b) = map(int, input().split())
c = 0
for i in range(a):
	l = list(input().split())
	if l[0] == '+':
		b += int(l[1])
	elif l[0] == '-':
		if b >= int(l[1]):
			b -= int(l[1])
		else:
			c += 1
print(b, c)


(a, b) = map(int, input().split())
k = int(0)
for _ in range(a):
	c = input().split(' ')
	if c[0] == '+':
		b = b + int(c[1])
	elif b - int(c[1]) >= 0:
		b = b - int(c[1])
	else:
		k = k + 1
print(b, k)


(t, initial) = map(int, input().split())
count = 0
while t != 0:
	s = input().split()
	a = s[0]
	b = int(s[1])
	if a == '+':
		initial += b
	elif b <= initial:
		initial = initial - b
	else:
		count += 1
	t = t - 1
print(initial, count)


(n, x) = map(int, input().split())
kids = 0
for i in range(n):
	array = list(input().split())
	if array[0] == '+':
		x += int(array[1])
	elif x >= int(array[1]):
		x -= int(array[1])
	else:
		kids += 1
print('{} {}'.format(x, kids))


(n, x) = map(int, input().split())
total = x
distressed_cnt = 0
for _ in range(n):
	(op, d) = input().split()
	d = int(d)
	if op == '+':
		total += d
	elif total >= d:
		total -= d
	else:
		distressed_cnt += 1
print(total, distressed_cnt)


(n, x) = [int(i) for i in input().split()]
g = 0
lst = []
while n:
	n -= 1
	lst = input().split()
	for i in lst:
		s = lst[0]
		ch = lst[1]
	if s == '+':
		x += int(ch)
	elif s == '-':
		if x >= int(ch):
			x -= int(ch)
		else:
			g += 1
print(str(x) + ' ' + str(g))


t = input()
(n, x) = t.split()
count = 0
tot = int(x)
dis = 0
while count < int(n):
	s = input().split()
	if s[0] == '+':
		tot += int(s[1])
	elif tot < int(s[1]):
		dis += 1
	else:
		tot -= int(s[1])
	count += 1
print(tot, dis)


try:
	(n, x) = list(map(int, input().split()))
	i = 0
	cnt = 0
	while i < n:
		l = list(map(str, input().split()))
		if l[0] == '+':
			x = x + int(l[1])
		elif x >= int(l[1]):
			x = x - int(l[1])
		else:
			cnt += 1
		i += 1
	print(x, cnt)
except:
	pass


import sys
(n, x) = map(int, sys.stdin.readline().split())
nbDistress = 0
for _ in range(n):
	(a, b) = sys.stdin.readline().strip().split()
	if a == '+':
		x += int(b)
	elif x >= int(b):
		x -= int(b)
	else:
		nbDistress += 1
print(x, nbDistress)


(n, inv) = (int(_) for _ in input().split())
distress = 0
for _ in range(n):
	(d, n) = input().split()
	n = int(n)
	if d == '+':
		inv += n
	elif inv < n:
		distress += 1
	else:
		inv -= n
print('{} {}'.format(inv, distress))


n = list(map(int, input().split()))
ammount = n[1]
distress = 0
value = 0
for i in range(n[0]):
	person = list(input().split())
	person[1] = int(person[1])
	if person[0] == '+':
		value = person[1]
	if person[0] == '-':
		value = -person[1]
	if not ammount + value < 0:
		ammount += value
	else:
		distress += 1
print('{} {}'.format(ammount, distress))


line = str(input())
(n, x) = line.split()
n = int(n)
x = int(x)
num = 0
for i in range(n):
	line = str(input())
	(cate, mount) = line.split()
	mount = int(mount)
	if cate == '+':
		x += mount
	elif cate == '-':
		if x >= mount:
			x -= mount
		else:
			num += 1
print(str(x) + ' ' + str(num))


from math import sqrt

def d(x1, x2, y1, y2):
	return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
(n, m) = input().split()
n = int(n)
m = int(m)
res = m
ans = 0
for i in range(n):
	(c, x) = input().split()
	x = int(x)
	if c == '+':
		res += x
	elif res >= x:
		res -= x
	else:
		ans += 1
print(res, ans)


(n, x) = map(int, input().split())
dk = 0
while n > 0:
	n -= 1
	(a, b) = input().split()
	if a == '+':
		x += int(b)
	elif x >= int(b):
		x -= int(b)
	else:
		dk += 1
print(x, dk)


import sys
(n, x) = map(int, sys.stdin.readline().split())
ans = 0
for i in range(n):
	(opt, num) = sys.stdin.readline().split()
	if opt == '+':
		x += int(num)
	else:
		want = int(num)
		if want > x:
			ans += 1
		else:
			x -= want
print(x, ans)


(n, x) = map(int, input().split())
sad = 0
for i in range(n):
	s = str(input())
	sgn = s[0]
	n = int(s[2:])
	if sgn == '+':
		x += n
	elif n > x:
		sad += 1
	else:
		x -= n
print(x, sad)


(n, m) = map(int, input().split())
ans = 0
for i in range(n):
	(x, y) = map(str, input().split())
	if x == '+':
		m += int(y)
	elif x == '-' and int(y) <= m:
		m -= int(y)
	elif x == '-' and int(y) > m:
		ans += 1
print(m, ans)


(n, m) = map(int, input().split())
cnt = 0
for i in range(n):
	(a, b) = input().split()
	if a == '+':
		m += int(b)
	elif int(b) > m:
		cnt += 1
	else:
		m -= int(b)
print(m, end=' ')
print(cnt)


(n, x) = map(int, input().split())
c = 0
while n:
	s = input().split()
	a = s[0]
	b = int(s[1])
	if a == '+':
		x = x + b
	elif x - b >= 0:
		x = x - b
	else:
		c = c + 1
	n = n - 1
print(x, c)


(x, y) = map(int, input().split())
c = 0
for i in range(x):
	st = str(input())
	myst = st.split(' ', 1)[1]
	myst = int(myst)
	if st[0] == '+':
		y = y + myst
	elif y >= myst:
		y = y - myst
	else:
		c = c + 1
print(y, c)


(n, x) = map(int, input().split())
t = 0
for _ in [0] * n:
	s = input().split()
	if s[0] == '+':
		x += int(s[1])
	elif x < int(s[1]):
		t += 1
	else:
		x -= int(s[1])
print(x, t)


(n, x) = map(int, input().split())
dis = 0
tot = x
for i in range(n):
	(s, a) = input().split(' ')
	a = int(a)
	if s == '-':
		a = -1 * a
	if a < 0:
		if tot < abs(a):
			dis += 1
		else:
			tot = tot - abs(a)
	else:
		tot += a
print(tot, dis)


(a, b) = list(map(int, input().split()))
s = b
d = 0
for _ in range(a):
	(c, i) = input().split(' ')
	if c == '+':
		s += int(i)
	elif c == '-':
		p = s - int(i)
		if p < 0:
			d += 1
		else:
			s = p
print(max(0, s), d)


(n, ice) = map(int, input().split())
kid = 0
arr = []
for i in range(n):
	(x, y) = map(str, input().split())
	arr.append((x, y))
for i in range(n):
	if arr[i][0] == '+':
		ice += int(arr[i][1])
	else:
		ice -= int(arr[i][1])
		if ice < 0:
			kid += 1
			ice += int(arr[i][1])
print(ice, end=' ')
print(kid)


(n, m) = map(int, input().split())
c = 0
for _ in range(n):
	x = input().split()
	if x[0] == '-':
		if m >= int(x[1]):
			m -= int(x[1])
		else:
			c += 1
	else:
		m += int(x[1])
print(m, c)


(n, x) = list(map(int, input().split()))
persons = []
values = []
total = x
count = 0
for _ in range(n):
	persons.append(input().split())
for i in range(n):
	if persons[i][0] == '+':
		values.append(int(persons[i][1]))
	else:
		values.append(0 - int(persons[i][1]))
for i in range(len(values)):
	total = total + values[i]
	if total < 0:
		count += 1
		total = total - values[i]
print(total, count)


(n, x) = map(int, input().split())
dis = 0
for _ in range(n):
	(si, d) = map(str, input().split())
	d = int(d)
	if si == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		dis += 1
print(x, dis)


(n, x) = map(int, input().split())
dis = 0
while n > 0:
	(sign, amt) = input().split()
	if sign == '+':
		x += int(amt)
	elif int(amt) > x:
		dis += 1
	else:
		x -= int(amt)
	n -= 1
print(x, dis)


def solve(test):
	ans = 0
	(n, x) = map(int, input().split())
	for i in range(n):
		c = input().split()
		if c[0] == '+':
			x += int(c[1])
		elif int(c[1]) > x:
			ans += 1
		else:
			x -= int(c[1])
	print(x, ans)
t = 1
for _ in range(t):
	solve(_ + 1)


(a, b) = map(int, input().split())
z = 0
for case in ' ' * a:
	c = int(input().replace(' ', ''))
	if b + c < 0:
		z += 1
	else:
		b = b + c
print(b, z)


(n, x) = map(int, input().split())
ans = 0
f = x
for i in range(n):
	(x, y) = map(str, input().split())
	if x == '+':
		f += int(y)
	elif f >= int(y):
		f -= int(y)
	else:
		ans += 1
print(f, ans)


added_test = input('')
k = list(map(int, added_test.split(' ')))
l_new = []
for i in range(k[0]):
	string = input('')
	l_new.append(string)
orig_value = k[1]
value = orig_value
num_child = 0
for i in range(k[0]):
	if l_new[i][0] == '-':
		string = l_new[i].split(' ')
		if value >= int(string[1]):
			value = orig_value - int(string[1])
			orig_value = value
		else:
			num_child = num_child + 1
	else:
		string = l_new[i].split(' ')
		value = orig_value + int(string[1])
		orig_value = value
print(value, num_child)


import sys
(n, x) = map(int, input().split())
cnt = 0
store = x
for i in range(n):
	string = input()
	d = int(string[2:])
	if string[0] == '+':
		store += d
	elif d > store:
		cnt += 1
	else:
		store -= d
print(store, cnt)


x = [int(x) for x in input().split()]
count = 0
for i in range(x[0]):
	s = [s for s in input().split()]
	if '+' in s:
		x[1] += int(s[1])
	elif '-' in s and x[1] >= int(s[1]):
		x[1] -= int(s[1])
	else:
		x[1] += 0
		count += 1
print(x[1], count)


(n, x) = list(map(int, input().split(' ')))
children = 0
for i in range(n):
	(op, v) = input().split(' ')
	v = int(v)
	if op == '+':
		x = x + v
	elif op == '-' and x >= v:
		x = x - v
	else:
		children += 1
print(*[x, children])


(n, x) = list(map(int, input().split()))
k = x
S = 0
for i in range(n):
	d = input().split()
	if eval('k' + ''.join(d)) < 0:
		S += 1
		continue
	k = eval('k' + ''.join(d))
	x = k
print(x, S)


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	(sym, intgr) = input().split()
	intgr = int(intgr)
	if sym == '+':
		x += intgr
	elif x >= intgr:
		x -= intgr
	else:
		count += 1
print(x, count, sep=' ')


(n, x) = list(map(int, input().split()))
c = 0
for i in range(n):
	(op, val) = input().split()
	val = int(val)
	if op == '+':
		x += val
	elif x < val:
		c += 1
	else:
		x -= val
print(x, c)


(n, answer) = map(int, input().split())
sad = 0
for i in range(n):
	(type, amount) = input().split(' ')
	if type == '+':
		answer += int(amount)
	elif int(amount) > answer:
		sad += 1
	else:
		answer -= int(amount)
print(answer, sad)


ata = input('').split(' ')
ata[0] = int(ata[0])
ata[1] = int(ata[1])
kid = 0
for i in range(ata[0]):
	op = input('').split(' ')
	op[1] = int(op[1])
	if op[0] == '+':
		ata[1] += op[1]
	elif op[0] == '-':
		if ata[1] < op[1]:
			kid += 1
		else:
			ata[1] -= op[1]
print(ata[1], kid)


inp = input().split()
n = int(inp[0])
x = int(inp[1])
arr = []
for i in range(n):
	arr.append(input().split())
count = x
dist = 0
for i in range(len(arr)):
	if arr[i][0] == '+':
		count = count + int(arr[i][1])
	else:
		check = int(arr[i][1])
		if count - check >= 0:
			count = count - check
		else:
			dist = dist + 1
print(count, end=' ')
print(dist)


(n, m) = map(int, input().split())
c = 0
for i in range(n):
	(a, t) = map(str, input().split())
	if a == '+':
		m += int(t)
	elif int(t) <= m:
		m -= int(t)
	else:
		c += 1
print(m, c, sep=' ')


(n, x) = map(int, input().split())
dis = 0
for i in range(n):
	(s, m) = input().split()
	m = int(m)
	if s == '+':
		x += m
	elif x >= m:
		x -= m
	else:
		dis += 1
print(str(x) + ' ' + str(dis))


(n, c) = map(int, input().split())
d = 0
for i in range(0, n):
	a = input()
	l = list(a.partition(' '))
	if l[0] == '+':
		c = c + int(l[2])
	elif l[0] == '-' and int(l[2]) <= c:
		c = c - int(l[2])
	elif l[0] == '-' and int(l[2]) > c:
		d = d + 1
print(c, d)


(n, x) = map(int, input().split())
o = 0
for _ in range(n):
	(c, p) = input().split()
	p = int(p)
	if c is '-':
		if p > x:
			o += 1
		else:
			x = x - p
	else:
		x = x + p
print(x, o)


(n, x) = map(int, input().split())
changes = []
kids = 0
for a in range(n):
	changes.append(input().split())
for c in changes:
	changing = c[0]
	numC = int(c[1])
	if changing == '+':
		x += numC
	elif x < numC:
		kids += 1
	else:
		x -= numC
print(x, kids)


(n, x) = map(int, input().split(' '))
counter = 0
for i in range(n):
	(op, num) = input().split(' ')
	num = int(num)
	if op == '+':
		x += num
	elif x - num >= 0:
		x -= num
	else:
		counter += 1
print(f'{x} {counter}')


nk = input()
nk = nk.split()
n = int(nk[0])
x = int(nk[1])
kides = 0
for i in range(n):
	holder = input()
	holder = holder.split()
	if holder[0] == '+':
		x = x + int(holder[1])
	elif int(holder[1]) > x:
		kides = kides + 1
	else:
		x = x - int(holder[1])
print(x, kides)


first = str(input())
first = first.split(' ')
n = int(first[0])
x = int(first[1])
d = []
sad = 0
for i in range(n):
	d = str(input())
	d = d.split(' ')
	if d[0] == '+':
		d = int(d[1])
	else:
		d = -int(d[1])
	if d < 0 and x >= -d:
		x += d
	elif d >= 0:
		x += d
	else:
		sad += 1
print(x, sad)


inp = input().split()
(n, x) = (int(inp[0]), int(inp[1]))
cnt = 0
for i in range(n):
	inp = input().split()
	(c, d) = (inp[0], int(inp[1]))
	if c == '+':
		x += d
		continue
	if d > x:
		cnt += 1
		continue
	x -= d
print(x, cnt)


(num, first) = map(int, input().split())
sad = 0
sumo = 0
for i in range(num):
	sispnu = input().split()
	if first < int(sispnu[1]) and sispnu[0] == '-':
		sumo += 1
	elif sispnu[0] == '+':
		first += int(sispnu[1])
	elif sispnu[0] == '-':
		first -= int(sispnu[1])
print(first, sumo, end='')


(n, x) = map(int, input().split())
(whoGive, whoTake) = (x, 0)
for i in range(n):
	q = input()
	if q[0] == '-':
		if int(q[2:]) > whoGive:
			whoTake += 1
		else:
			whoGive -= int(q[2:])
	else:
		whoGive += int(q[2:])
print(whoGive, whoTake)


[n, x] = list(map(int, input().split(' ')))
c = 0
for i in range(n):
	[o, v] = input().split(' ')
	if o == '+':
		x += int(v)
	else:
		(c, x) = (c + 1, x) if int(v) > x else (c, x - int(v))
print(x, c)


x = input().split()
a = []
initially = int(x[1])
Whave = initially
numberofboys = 0
for i in range(int(x[0])):
	newElement = input()
	a.append(newElement)
	if a[i][0] == '+':
		Whave += int(a[i][1:])
	elif a[i][0] == '-' and Whave - int(a[i][1:]) >= 0:
		Whave -= int(a[i][1:])
	else:
		numberofboys += 1
print(Whave, numberofboys)


(n, x) = map(int, input().split())
res = x
cwd = 0
for i in range(n):
	l = [n for n in input().split()]
	l1 = int(l[1])
	if l[0] == '+':
		res += l1
	elif l[0] == '-':
		if l1 <= res:
			res = res - l1
		else:
			cwd = cwd + 1
print(str(res) + ' ' + str(cwd))


(n, k) = list(map(int, input().split()))
t = 0
for x in range(n):
	(p, l) = list(map(str, input().split()))
	if p == '+':
		k += int(l)
	elif k - int(l) >= 0:
		k -= int(l)
	else:
		t += 1
print(k, t)


data = [int(d1) for d1 in input().split()]
q = []
for l in range(data[0]):
	q.append(input().split())
ic = data[1]
sk = 0
for p in q:
	if p[0] == '+':
		ic += int(p[1])
	elif ic >= int(p[1]):
		ic -= int(p[1])
	else:
		sk += 1
res = str(ic) + ' ' + str(sk)
print(res)


import operator as op
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import reduce
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def def_value():
	return 0
(n, m) = invr()
dis = 0
for i in range(n):
	(s, d) = input().split()
	d = int(d)
	if s == '+':
		m += d
	elif m >= d:
		m -= d
	else:
		dis += 1
print(m, dis)


(n, x) = map(int, input().split())
count = 0
for _ in range(n):
	(sign, amount) = input().split()
	amount = int(amount)
	if sign == '+':
		x += amount
	elif x >= amount:
		x -= amount
	else:
		count += 1
print(str(x) + ' ' + str(count))


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
(n, x) = get_ints()
distress = 0
for i in range(n):
	(a, b) = input().split()
	if a == '+':
		x += int(b)
	elif x >= int(b):
		x -= int(b)
	else:
		distress += 1
print(x, distress)


(n, x) = input().strip().split()
n = int(n)
x = int(x)
q = []
for i in range(n):
	temp = input().strip().split()
	q.append((temp[0], int(temp[1])))
kid = 0
for i in range(n):
	if q[i][0] == '+':
		x += q[i][1]
	elif q[i][0] == '-':
		if x < q[i][1]:
			kid += 1
		else:
			x -= q[i][1]
print(x, end=' ')
print(kid, end='')


import time
(n, x) = (int(i) for i in input().split())
ans = 0
for i in range(n):
	(f, d) = [i for i in input().split()]
	d = int(d)
	if f == '-':
		if x >= d:
			x = x - d
		else:
			ans = ans + 1
	else:
		x = x + d
start = time.time()
print(x, ans)
finish = time.time()


(n, x) = map(int, input().split())
d = 0
for _ in range(n):
	s = input()
	(s1, s2) = ('', '')
	if s[0] == '+':
		for i in range(2, len(s)):
			s1 += s[i]
		x += int(s1)
	else:
		for j in range(2, len(s)):
			s2 += s[j]
		if x >= int(s2):
			x -= int(s2)
		else:
			d += 1
print(x, d)


(n, x) = (int(v) for v in input().split())
ans = 0
for _ in range(n):
	inp = input().split()
	val = int(inp[1])
	sign = inp[0]
	if sign == '+':
		x += val
	elif x < val:
		ans += 1
	else:
		x -= val
print(x, ans)


(n, x) = input().split()
(n, x) = (int(n), int(x))
distres = 0
for _ in range(n):
	step = input().split()
	(op, Di) = (step[0], int(step[1]))
	if op == '+':
		x += Di
	elif op == '-' and Di <= x:
		x -= Di
	else:
		distres += 1
print(x, distres)


(c, qua) = map(int, input().split())
counter = 0
for i in range(c):
	(sign, k) = input().split()
	k = int(k)
	if sign == '+':
		qua += k
	elif sign == '-' and qua >= k:
		qua -= k
	else:
		counter += 1
print(qua, counter)


import sys
(T, N) = map(int, sys.stdin.readline().split())
(left, distressed) = (N, 0)
for i in range(T):
	(a, b) = map(str, sys.stdin.readline().split())
	if a == '+':
		left += int(b)
	elif a == '-':
		if left >= int(b):
			left -= int(b)
		elif left < int(b):
			distressed += 1
print(' '.join((str(x) for x in [left, distressed])))


(n, ice) = map(int, input().split())
dis = 0
for i in range(n):
	(a, b) = map(str, input().split())
	if a == '+':
		ice += int(b)
	elif a == '-':
		ice -= int(b)
		if ice < 0:
			ice += int(b)
			dis += 1
print(ice, dis)


import math
import random

def main():
	(n, x) = [int(x) for x in input().split()]
	u = 0
	for i in range(n):
		(a, b) = input().split()
		b = int(b)
		if a == '-':
			if x >= b:
				x -= b
			else:
				u += 1
		else:
			x += b
	print(x, u)
main()


import sys

def func():
	(n, initial_candy) = map(int, input().split())
	distress_number = 0
	for i in range(n):
		(sign, p) = sys.stdin.readline().split()
		p = int(p)
		if sign == '+':
			initial_candy += p
		elif initial_candy >= p:
			initial_candy -= p
		else:
			distress_number += 1
	sys.stdout.write(str(initial_candy) + ' ' + str(distress_number))
func()


def main():
	k = 0
	(n, x) = map(int, input().split())
	for i in range(n):
		(a, b) = input().split()
		if a == '+':
			x += int(b)
		elif x - int(b) < 0:
			k += 1
		else:
			x -= int(b)
	print(x, k)
main()


t = list(map(int, input().split()))
cou = 0
for i in range(t[0]):
	w = list(input().split())
	if w[0] == '+':
		t[1] = t[1] + int(w[1])
	else:
		a = t[1]
		if a - int(w[1]) < 0:
			cou = cou + 1
		else:
			t[1] = t[1] - int(w[1])
print(t[1], cou)


(n, q) = map(int, input().strip().split(' '))
k = 0
for i in range(n):
	l = list(map(str, input().strip().split(' ')))
	if l[0] == '+':
		q = q + int(l[1])
	elif q >= int(l[1]):
		q = q - int(l[1])
	else:
		k += 1
print(q, k)


(n, x) = map(int, input().split())
s = 0
for _ in ' ' * n:
	(f, d) = input().split()
	d = int(d)
	if f == '-':
		if d > x:
			s += 1
		else:
			x -= d
	else:
		x += d
print(x, s)


v = list(map(int, input().split()))
n = v[0]
x = v[1]
crnt = x
dis = 0
for i in range(0, n):
	x = list(input().split())
	x1 = int(x[1])
	if x[0] == '-':
		if crnt >= x1:
			crnt -= x1
		else:
			dis += 1
	elif x[0] == '+':
		crnt += x1
print(crnt, dis)


c = 0
(n, x) = [int(i) for i in input().split()]
for i in range(n):
	(d, d2) = input().split()
	if '+' == d:
		x = x + int(d2)
	elif '-' == d:
		if x < int(d2):
			c = c + 1
		elif x >= int(d2):
			x = x - int(d2)
print(x, c)


(n, x) = list(map(int, input().split(' ')))
(i, kids) = (0, 0)
while i < n:
	(c, d) = input().split(' ')
	if c == '+':
		x += int(d)
	elif int(d) > x:
		kids += 1
	else:
		x -= int(d)
	i += 1
print(x, kids)


(a, b) = map(int, input().split())
Sum = b
n = 0
while a:
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		Sum += y
	elif Sum >= y:
		Sum -= y
	else:
		n += 1
	a -= 1
print(Sum, n)


(n, x) = [int(i) for i in input().split()]
q = []
c = 0
for i in range(n):
	(i, n) = input().split()
	if i == '+':
		q += [int(n)]
	else:
		q += [-int(n)]
for i in q:
	x += i
	if x < 0:
		c += 1
		x -= i
print(x, c)


(sad, cnt) = (0, 0)
(n, cnt) = map(int, input().split())
for _ in range(n):
	(c, k) = input().split()
	k = int(k)
	if c == '+':
		cnt += k
	elif k <= cnt:
		cnt -= k
	else:
		sad += 1
print(cnt, sad)


(n, k) = map(int, input().split())
c = 0
for i in range(n):
	s = list(map(str, input().split()))
	if s[0] == '+':
		k = k + int(s[1])
	elif int(s[1]) <= k:
		k = k - int(s[1])
	else:
		c += 1
print(k, c)


f = 0
(n, h) = input().split(' ')
a = (n, h)
a = list(a)
for i in range(len(a)):
	a[i] = int(a[i])
for k in range(a[0]):
	char = input()
	l = list()
	l.extend(char.split())
	l[1] = int(l[1])
	if l[0] == '+':
		a[1] = a[1] + l[1]
	elif l[0] == '-':
		if l[1] > a[1]:
			f += 1
		else:
			a[1] = a[1] - l[1]
print(a[1], f, sep=' ')


a = input().split()
k = int(a[0])
l = int(a[1])
s = ''
d = 0
for i in range(k):
	j = str(input())
	if j.startswith('+'):
		l = l + int(j[1:])
	elif int(j[1:]) <= l:
		l = l - int(j[1:])
	else:
		d = d + 1
print(l, d)


import sys
(n, x) = list(map(int, sys.stdin.readline().split()))
s = []
ice = x
sad = 0
for i in range(n):
	s = input().split()
	if s[0] == '+':
		ice += int(s[1])
	elif ice >= int(s[1]):
		ice -= int(s[1])
	else:
		sad += 1
print(ice, sad)


(n, x) = map(int, input().split())
ans1 = 0
for i in range(n):
	line = input()
	cmd = line.split()[0]
	num = int(line.split()[1])
	if cmd == '+':
		x += num
	elif x < num:
		ans1 += 1
	else:
		x -= num
print('{} {}'.format(x, ans1))


(x, y) = map(int, input().split())
k = 0
for i in range(x):
	a = input()
	if a[0] == '+':
		y += int(a[1:len(a)])
	if a[0] == '-':
		if int(y) - int(a[1:len(a)]) < 0:
			k += 1
		elif int(y) - int(a[1:len(a)]) >= 0:
			y -= int(a[1:len(a)])
print(y, k)


(n, x) = map(int, input().split())
a = [[j for j in input().split()] for i in range(int(n))]
count = 0
for i in range(n):
	if a[i][0] == '+':
		x += int(a[i][1])
	elif a[i][0] == '-' and x < int(a[i][1]):
		count += 1
	else:
		x -= int(a[i][1])
print(x, count)


(n, x) = map(int, input().strip().split())
oper = []
child = 0
for _ in range(n):
	(z, d) = input().split()
	d = int(d)
	if z == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		child += 1
print(x, child)


(n, x) = list(map(int, input().split()))
c = 0
for i in ' ' * n:
	s = input()
	if s[0] == '+':
		x += int(s[2:])
	elif int(s[2:]) > x:
		c += 1
	else:
		x -= int(s[2:])
print(str(x) + ' ' + str(c))


(n, x) = [int(j) for j in input().split()]
ans = 0
for i in range(n):
	(c, d) = input().split()
	if c == '+':
		k = int(d)
		x += int(d)
	elif c == '-':
		k = int(d)
		if x - k < 0:
			ans += 1
		else:
			x -= k
print(x, ans)


(n, m) = [int(x) for x in input().split()]
d = 0
for i in range(n):
	s = input()
	if s[0] == '+':
		m += int(s[2:])
	else:
		w = int(s[2:])
		if m >= w:
			m -= w
		else:
			d += 1
print(m, d)


(n, x) = map(int, str(input()).split())
sad = 0
for i in range(n):
	(sign, amount) = str(input()).split()
	amount = int(amount)
	if sign == '+':
		x += amount
	elif sign == '-':
		if x >= amount:
			x -= amount
		else:
			sad += 1
print(x, sad)


l1 = [int(num) for num in input().split(' ')]
n = l1[0]
x = l1[1]
d_kids = 0
for i in range(n):
	l2 = [shit for shit in input().split(' ')]
	if l2[0] == '+':
		x += int(l2[1])
	elif int(l2[1]) > x:
		d_kids += 1
	else:
		x -= int(l2[1])
print(x, d_kids)


(n, x) = map(int, input().split())
r = x
s = 0
for i in range(n):
	(sy, d) = input().split()
	d = int(d)
	if sy == '+':
		r += d
	elif sy == '-':
		if r >= d:
			r -= int(d)
		else:
			s += 1
print(r, s)


(n, d) = map(int, input().split())
ans = 0
for _ in range(n):
	x = input().strip()
	a = x.split(' ')
	dau = a[0]
	so = int(a[1])
	if dau == '-':
		a = d - so
		if a < 0:
			ans += 1
		else:
			d = a
	elif dau == '+':
		d += so
print(d, ans)


(n, ice) = [int(i) for i in input().split()]
kid = 0
for i in range(n):
	(c, x) = input().split()
	x = int(x)
	if c == '+':
		ice += x
	elif x > ice:
		kid += 1
	else:
		ice -= x
print(ice, kid)


(n, stock) = map(int, input().split())
disapp = 0
for i in range(n):
	(transaction, order_amt) = input().split()
	order_amt = int(order_amt)
	if transaction == '-':
		if stock - order_amt < 0:
			disapp += 1
		else:
			stock -= order_amt
	else:
		stock += order_amt
print(stock, disapp)


(a, Sum) = map(int, input().split())
n = 0
for i in range(a):
	(x, y) = input().split()
	if x == '+':
		Sum += int(y)
	elif Sum >= int(y):
		Sum -= int(y)
	else:
		n += 1
print(Sum, n)


(n, x) = list(map(int, input().split()))
count = 0
for _ in range(n):
	l = list(map(str, input().split(' ')))
	l[1] = int(l[1])
	if l[0] == '+':
		x += l[1]
	elif l[0] == '-':
		if x >= l[1]:
			x -= l[1]
		else:
			count += 1
print(x, count)


(m, n) = map(int, input().split())
c = 0
for _ in range(m):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		n += b
		continue
	elif n < b:
		c += 1
		continue
	n = n - b
print(n, c)


(n, x) = map(int, input().split())
ans = 0
for _ in range(n):
	(s, v) = input().split()
	v = int(v)
	if s == '+':
		x += v
	elif x >= v:
		x -= v
	else:
		ans += 1
print(x, ans)


(n, x) = map(int, input().split())
dis = 0
for _ in range(n):
	s = input()
	if s[0] == '+':
		x = x + int(s[2:])
	else:
		need = int(s[2:])
		if need > x:
			dis += 1
		else:
			x = x - need
print(x, dis)


(n, x) = map(int, input().split())
kol = 0
for i in range(n):
	vvod = int(''.join(input().split()))
	if vvod > 0:
		x += vvod
	elif x >= -vvod:
		x += vvod
	else:
		kol += 1
print(x, kol)


count = 0
(a, b) = map(int, input().split())
for i in range(a):
	(c, d) = map(str, input().split())
	d = int(d)
	if c == '+':
		b += d
	elif b - d >= 0:
		b -= d
	else:
		count += 1
print(b, count, sep=' ')


import math
(t, x) = list(map(int, input().split()))
sum = x
dis = 0
while t:
	(s, n) = list(map(str, input().split()))
	if s == '+':
		sum = sum + int(n)
	elif sum - int(n) >= 0:
		sum = sum - int(n)
	else:
		dis = dis + 1
	t = t - 1
print(sum, dis)


(n, x) = map(int, input().split())
k = 0
for i in range(n):
	s = str(input())
	x1 = int(s[2:])
	if s[0] == '-' and x >= x1:
		x -= x1
	elif s[0] == '-' and x1 > x:
		k += 1
	elif s[0] == '+':
		x += x1
print(x, k)


(n, x) = map(int, input().split())
a = 0
for i in range(n):
	s = input()
	if s.startswith('+'):
		x = x + int(s[2:])
	elif s.startswith('-'):
		if x <= 0 or x < int(s[2:]):
			a = a + 1
		else:
			x = x - int(s[2:])
print(x, a)


l1 = input().split()
procss = int(l1[0])
packsnum = int(l1[1])
ls = []
n = 0
for x in range(procss):
	ls.insert(x, input().split())
for x in range(procss):
	if ls[x][0] == '+':
		packsnum += int(ls[x][1])
	if ls[x][0] == '-':
		if packsnum < int(ls[x][1]):
			n += 1
			continue
		packsnum -= int(ls[x][1])
print(packsnum, end=' ')
print(n)


(a, b) = map(int, input().split())
b1 = 0
for i in range(a):
	(a1, a2) = map(str, input().split())
	a2 = int(a2)
	if a1 == '+':
		b += a2
	elif b < a2:
		b1 += 1
	else:
		b -= a2
print(b, b1)


input_line = input().split()
(n, x) = (int(input_line[0]), int(input_line[1]))
boiz = 0
for i in range(n):
	(sign, value) = input().split()
	if sign == '+':
		x += int(value)
	elif int(value) > x:
		boiz += 1
	else:
		x -= int(value)
print(x, boiz)


(a, b) = map(int, input().split())
e = b
f = 0
h = 0
while f < a:
	(c, d) = input().split()
	if c == '+':
		e += int(d)
	elif e < int(d):
		h += 1
	else:
		e -= int(d)
	f += 1
print(e, end=' ')
print(h)


(n, x) = map(int, input().split())
a = 0
for i in range(n):
	d = int(input().replace(' ', ''))
	if d > 0:
		x += d
	elif x >= abs(d):
		x += d
	else:
		a += 1
print('{0} {1}'.format(x, a))


(n, x) = map(int, input().split())
count = 0
while n:
	(op, p) = map(str, input().split())
	if op == '+':
		x = x + int(p)
	elif x >= int(p):
		x = x - int(p)
	else:
		count += 1
	n -= 1
print(x, end=' ')
print(count)


(n, b) = map(int, input().split())
total = b
kid = 0
for i in range(n):
	z = input()
	if z[0] == '-':
		if int(z[2:]) > total:
			kid += 1
		else:
			total = total - int(z[2:])
	elif z[0] == '+':
		total += int(z[2:])
print(total, kid)


(x, y) = input().split()
x = int(x)
y = int(y)
countpeople = 0
for i in range(x):
	(z, w) = input().split()
	w = int(w)
	if z == '-':
		if y >= w:
			y -= w
		else:
			countpeople += 1
	else:
		y += w
print(y, countpeople)


(n, m) = map(int, input().split())
c = 0
for _ in range(n):
	(a, b) = map(str, input().split())
	if a == '-':
		if m >= int(b):
			m -= int(b)
		else:
			c += 1
	else:
		m += int(b)
print(m, c)


(n, x) = map(int, input().split())
l = 0
for i in range(n):
	(opr, opnd) = input().split()
	opnd = int(opnd)
	if opr == '-':
		if opnd <= x:
			x -= opnd
		else:
			l += 1
	else:
		x += opnd
print(x, l)


(n, k) = map(int, input().split())
ka = 0
for i in range(n):
	(x, y) = map(str, input().split())
	y = int(y)
	if x == '+':
		k = k + y
	elif k >= y:
		k = k - y
	else:
		ka = ka + 1
print(k, ka)


(n, x) = [int(x) for x in input().split()]
dist = 0
for _ in range(n):
	line = input().split()
	d = int(line[1])
	if line[0] == '+':
		x += d
	elif d <= x:
		x -= d
	else:
		dist += 1
print(x, dist)


(n, x) = map(int, input().split(' '))
lines = [input() for _ in range(n)]
distressed = 0
for line in lines:
	(operator, operand) = line.split(' ')
	operand = int(operand)
	distressed += 1 if operator == '-' and x < operand else 0
	x += operand if operator == '+' else 0 if x < operand else -operand
print(x, distressed)


(x, y) = map(int, input().split())
k = 0
s = y
for i in range(x):
	a = input()
	if s - int(a[2:]) < 0 and a[0] == '-':
		k = k + 1
		continue
	if a[0] == '-':
		s = s - int(a[2:])
	else:
		s = s + int(a[2:])
print(s, k)


def free_ice_cream(n, x):
	sad_kid = 0
	for _i in range(n):
		value = input().split()
		if value[0] == '+':
			x += int(value[1])
		elif value[0] == '-' and int(value[1]) > x:
			sad_kid += 1
		else:
			x -= int(value[1])
	print(x, sad_kid)

def main():
	(n, x) = (int(i) for i in input().split())
	free_ice_cream(n, x)
main()


nx = list(map(int, input().split()))
distrees = 0
while nx[0] > 0:
	signNumber = list(map(str, input().split()))
	s = ''.join((str(ch) for ch in signNumber))
	d = int(s[1:len(s)])
	if signNumber[0] == '+':
		nx[1] += d
	elif signNumber[0] == '-' and d > nx[1]:
		distrees += 1
	elif signNumber[0] == '-' and d <= nx[1]:
		nx[1] -= d
	nx[0] -= 1
print(nx[1], distrees)


(n, p) = input().split()
(n, p) = (int(n), int(p))
k = 0
for i in range(0, n):
	(o, d) = input().split()
	d = int(d)
	if o == '+':
		p += d
	elif d > p:
		k += 1
	else:
		p -= d
print(p, k)


import sys

def main():
	x = sys.stdin.readline().split()
	(n, x) = (int(x[0]), int(x[1]))
	g = 0
	for i in range(n):
		y = sys.stdin.readline().split()
		k = int(y[1])
		if y[0] == '-':
			if k > x:
				g += 1
			else:
				x -= k
		else:
			x += k
	print(x, g)
main()


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	(n, x) = mp()
	c = 0
	for _ in range(n):
		a = input().split()
		if a[0] == '+':
			x += int(a[1])
		elif x >= int(a[1]):
			x -= int(a[1])
		else:
			c += 1
	print(x, c)
for _ in range(1):
	solve()


import sys
import math
(n, packs) = map(int, input().split())
distress = 0
for _ in range(n):
	s = input().split()
	if s[0] == '+':
		packs += int(s[1])
	elif packs >= int(s[1]):
		packs -= int(s[1])
	else:
		distress += 1
print(packs, distress)


start = input().split(' ')
number_of_ice_creams = int(start[1])
sad_kids = 0
for x in range(int(start[0])):
	arrive = input().split(' ')
	number_of = int(arrive[1])
	if arrive[0] == '+':
		number_of_ice_creams += number_of
	elif number_of_ice_creams >= number_of:
		number_of_ice_creams -= number_of
	else:
		sad_kids += 1
print(number_of_ice_creams, sad_kids)


(n, x) = map(int, input().split())
kid = 0
for _ in range(n):
	(cmd, diff) = input().split()
	diff = int(diff)
	if cmd == '+':
		x += diff
	elif cmd == '-':
		if x >= diff:
			x -= diff
		else:
			kid += 1
print(x, kid)


(ni, xi) = input().split()
n = int(ni)
x = int(xi)
ls = []
kid = 0
for i in range(n):
	ls.append(input().split())
for i in range(n):
	if ls[i][0] == '+':
		x += int(ls[i][1])
	elif ls[i][0] == '-' and int(ls[i][1]) <= x:
		x -= int(ls[i][1])
	else:
		kid += 1
print(x, kid)


(n, m) = map(int, input().split())
o = 0
for i in range(n):
	t = input().split()
	if t[0] == '+':
		m += int(t[1])
	elif m >= int(t[1]):
		m -= int(t[1])
	else:
		o += 1
print(m, o)


def main():
	(x, n) = map(int, input().split())
	distressed = 0
	for i in range(x):
		k = input()
		if k[0] == '+':
			n += int(k[1:])
		elif int(k[1:]) <= n:
			n -= int(k[1:])
		else:
			distressed += 1
	print(n, distressed, sep=' ')
main()


(n, count) = map(int, input().split())
kids = 0
for i in range(n):
	x = input()
	x = x.replace(' ', '')
	x = int(x)
	if x > 0:
		count += x
	elif count + x < 0:
		kids += 1
	else:
		count += x
print(count, kids)


mad_kid = 0
signs = []
num = []
(n, x) = map(int, input('').split())
for i in range(0, n):
	d = input('')
	num.append(d[2:])
	signs.append(d[0])
for j in range(0, len(signs)):
	if signs[j] == '+':
		x += int(num[j])
	elif signs[j] == '-':
		if x >= int(num[j]):
			x -= int(num[j])
		else:
			mad_kid += 1
print(x, mad_kid)


def main():
	(n, total_packs) = [int(x) for x in input().split()]
	distressed_children = 0
	for i in range(n):
		(a, packs) = input().split()
		if a == '+':
			total_packs += int(packs)
		if a == '-':
			if int(packs) <= total_packs:
				total_packs -= int(packs)
			else:
				distressed_children += 1
	print(total_packs, distressed_children)
main()


a = input().split()
lines = int(a[0])
initial = int(a[1])
dis = 0
for i in range(lines):
	per = input().split()
	op = per[0]
	num = int(per[1])
	if op == '+':
		initial += num
	elif initial - num < 0:
		dis += 1
	else:
		initial -= num
print(str(initial) + ' ' + str(dis))


(n, x) = map(int, input().split())
t = 0
for i in range(n):
	(sign, num) = map(str, input().split())
	if sign == '+':
		x += int(num)
	elif int(num) > x:
		t += 1
	else:
		x -= int(num)
print(x, t)


(n, x) = map(int, input().split())
y = 0
for _ in range(n):
	(tp, d) = input().split()
	d = int(d)
	if tp == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		y += 1
print(x, y)


(n, x) = map(int, input().split())
people = list()
for _ in range(0, n):
	(type, quantity) = input().split()
	people.append([type, int(quantity)])
ic_packs = x
kids = 0
for p in people:
	if p[0] == '+':
		ic_packs += p[1]
	elif p[1] > ic_packs:
		kids += 1
	else:
		ic_packs -= p[1]
print(str(ic_packs) + ' ' + str(kids))


z = input().split()
(n, x) = map(int, z)
distress = 0
for i in range(n):
	d = input()
	if d[0] == '+':
		x += int(d[2:])
	elif x >= int(d[2:]):
		x -= int(d[2:])
	else:
		distress += 1
print(x, distress)


(n, k) = map(int, input().split())
p = 0
for _ in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		k += b
	elif k - b >= 0:
		k -= b
	else:
		p += 1
print(str(k) + ' ' + str(p), end='')


(c, v) = map(int, input().split())
f = v
g = 0
for i in range(c):
	n = str(input())
	n = n.replace(' ', '')
	s = int(n)
	if int(n) > 0:
		f += int(n)
	elif s < 0:
		if f + s >= 0:
			f += int(n)
		else:
			g += 1
print(f, g)


(n, x) = list(map(int, input().split()))
b = 0
kids = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		x += b
	elif x >= b:
		x += -b
	else:
		kids += 1
print(x, kids, sep=' ')


k = 0
(n, x) = [int(i) for i in input().split()]
for b in range(n):
	(a, d) = [i for i in input().split()]
	if a == '+':
		x += int(d)
	elif a == '-':
		if x >= int(d):
			x -= int(d)
		elif x < int(d):
			k += 1
print(x, k)


from sys import stdin, stdout
(n, cnt) = map(int, stdin.readline().split())
ans = 0
for i in range(n):
	(lab, val) = stdin.readline().split()
	if lab == '+':
		cnt += int(val)
	elif int(val) > cnt:
		ans += 1
	else:
		cnt -= int(val)
stdout.write(str(cnt) + ' ' + str(ans))


(n, x) = map(int, input().split())
a = []
for i in range(n):
	(b, c) = map(str, input().split())
	a.append((b, int(c)))
d = x
e = 0
for i in range(len(a)):
	if a[i][0] == '+':
		d += a[i][1]
	elif a[i][1] <= d:
		d -= a[i][1]
	else:
		e += 1
		continue
print(d, e)


(n, k) = map(int, input().split())
tmp = k
ans = 0
for _ in range(n):
	(t, k) = input().split()
	k = int(k)
	if t == '+':
		tmp += int(k)
	elif int(k) <= tmp:
		tmp -= int(k)
	else:
		ans += 1
print(tmp, ans)


(n, x) = map(int, input().split())
distress = 0
for i in range(n):
	d = list(map(str, input().split()))
	if d[0] == '+':
		x += int(d[1])
	elif int(d[1]) <= x:
		x -= int(d[1])
	else:
		distress += 1
print(x, distress)


c = 0
(n, x) = map(int, input().split(' '))
for i in range(n):
	(z, number) = input().split(' ')
	if z == '+':
		x += int(number)
	elif int(number) > x:
		c += 1
	else:
		x -= int(number)
print(x, c)


import math

def run(operations, init_icecream):
	left_icecream = init_icecream
	sad_kid = 0
	for operation in operations:
		if operation[0] == '-':
			if operation[1] <= left_icecream:
				left_icecream -= operation[1]
			else:
				sad_kid += 1
		else:
			left_icecream += operation[1]
	res = str(left_icecream) + ' ' + str(sad_kid)
	return res
(num_op, init_icecream) = input().split()
num_op = int(num_op)
init_icecream = int(init_icecream)
index = 0
operations = []
while index < num_op:
	an_op = []
	(x, y) = input().split()
	an_op.append(x)
	an_op.append(int(y))
	operations.append(an_op)
	index += 1
print(run(operations, init_icecream))


(n, ic) = list(map(int, input().split()))
ans = 0
for _ in range(n):
	(sg, i) = input().split()
	i = int(i)
	if sg == '+':
		ic += i
	elif ic >= i:
		ic -= i
	else:
		ans += 1
print(ic, ans)


(n, x) = map(int, input().split())
k = 0
for _ in [0] * n:
	a = input().split()
	d = int(a[1])
	if a[0] == '-':
		(k, x) = (k + 1, x) if x < d else (k, x - d)
	else:
		x += d
print(x, k)


k = input().split(' ')
n = int(k[0])
x = int(k[1])
o = 0
for i in range(n):
	k = input().split(' ')
	s = k[0]
	d = int(k[1])
	if s == '+':
		x += int(k[1])
	elif s == '-' and x >= d:
		x -= d
	elif s == '-' and x < d:
		o += 1
print(x, o)


(k, r) = map(int, input().split())
c = 0
for i in range(k):
	(s, a) = map(str, input().split())
	a = int(a)
	if s == '+':
		r += a
	elif r >= a:
		r -= a
	else:
		c += 1
print(r, c)


(n, x) = map(int, input().split())
ice_now = x
distress = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '-':
		if ice_now >= b:
			ice_now -= b
		else:
			distress += 1
	elif a == '+':
		ice_now += b
print(ice_now, distress)


ss = input()
con = ss.split(' ')
x = int(con[1])
n = int(con[0])
dis = 0
c = ''
for i in range(1, 1010):
	if i > n:
		break
	s = input()
	con = s.split(' ')
	c = con[0]
	t = int(con[1])
	if c == '+':
		x += t
	if c == '-':
		if x < t:
			dis = dis + 1
		else:
			x = x - t
print(f'{x} {dis}')


(n, packs) = map(int, input().split())
distressed = 0
for _ in range(n):
	query = input()
	if query[0] == '+':
		packs += int(query[2:])
	else:
		wanted_icecream = int(query[2:])
		if wanted_icecream > packs:
			distressed += 1
		else:
			packs -= wanted_icecream
print(packs, distressed)


(n, x) = map(int, input().split())
ans = 0
curr = x
for _ in range(n):
	(a, b) = input().split()
	d = int(b)
	if a == '+':
		curr += d
	elif curr >= d:
		curr -= d
	else:
		ans += 1
print(curr, ans)


import re
n = list(map(int, input().split()))
s = n[1]
k = 0
for i in range(n[0]):
	m = input()
	if '-' in m:
		m_new = -int(re.search('\\d+', m).group())
		if s >= abs(m_new):
			s += m_new
		else:
			k += 1
	if '+' in m:
		m_new = int(re.search('\\d+', m).group())
		s += m_new
print(s, k)


nx = input().split(' ')
n = int(nx[0])
x = int(nx[1])
m = list()
c = 0
for i in range(n):
	d = input()
	m = m + [d]
for i in range(n):
	k = m[i].split(' ')
	if k[0] == '+':
		x = x + int(k[1])
	elif x >= int(k[1]):
		x = x - int(k[1])
	else:
		c = c + 1
print(x, c)


(a, b) = input().strip().split(' ')
(a, b) = [int(a), int(b)]
ans = b
count = 0
for i in range(a):
	l = list(input().strip().split(' '))
	if l[0] == '+':
		ans = ans + int(l[1])
	if l[0] == '-':
		ans = ans - int(l[1])
		if ans >= 0:
			pass
		else:
			ans = ans + int(l[1])
			count = count + 1
print(str(ans) + ' ' + str(count))


(n, x) = [int(i) for i in input().split()]
numDistress = 0
for i in range(n):
	di = input().split()
	di[1] = int(di[1])
	if di[0] == '+':
		x = x + di[1]
	elif x >= di[1]:
		x = x - di[1]
	else:
		numDistress += 1
print(x, numDistress)


(n, x) = map(int, input().split())
r = [0] * 2
for i in range(n):
	(s1, s2) = map(str, input().split())
	s2 = int(s2)
	if s1 == '+':
		x += s2
	elif x >= s2:
		x -= s2
	else:
		r[1] += 1
r[0] += x
print(*r)


(n, sum) = map(int, input().split())
ch = 0
for i in range(n):
	a = input().split()
	if a[0] == '+':
		sum += int(a[1])
	elif a[0] == '-' and int(a[1]) <= sum:
		sum -= int(a[1])
	else:
		ch += 1
print(sum, ch, sep=' ')


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	(sign, no1) = input().split()
	no = int(no1)
	if sign == '+':
		x += no
	elif sign == '-':
		if x >= no:
			x -= no
		else:
			count += 1
print(x, end=' ')
print(count)


(n, x) = list(map(int, input().split()))
distressed = 0
for i in range(n):
	f = input().split()
	if f[0] == '+':
		x += int(f[1])
	elif x >= int(f[1]):
		x -= int(f[1])
	else:
		distressed += 1
print(x, distressed)


import sys

def inputs():
	inp = sys.stdin.readline()
	return inp
(n, x) = map(int, inputs().split())
distress = 0
for _ in range(n):
	(need, cream) = map(str, inputs().split())
	if need == '+':
		x += int(cream)
	elif need == '-':
		if x - int(cream) >= 0:
			x -= int(cream)
		else:
			distress += 1
print(x, distress)


import math
(n, x) = (int(j) for j in input().split())
distress = 0
for i in range(n):
	(sign, amount) = (j for j in input().split())
	amount = int(amount)
	if sign == '+':
		x += amount
	elif amount > x:
		distress += 1
	else:
		x -= amount
print(str(x) + ' ' + str(distress))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(N, X) = map(int, input().split())
total = X
distres = 0
for i in range(N):
	(o, v) = input().split()
	v = int(v)
	if o == '+':
		total += v
	elif total >= v:
		total -= v
	else:
		distres += 1
print(total, distres)


(n, x) = map(int, input().split())
count = 0
for _ in range(n):
	(c, v) = input().split()
	v = int(v)
	if c == '+':
		x = x + v
	if c == '-':
		if v <= x:
			x = x - v
		else:
			count += 1
print(x, count)


inp = input()
inp = inp.split()
gr = 0
n = int(inp[0])
x = int(inp[1])
for i in range(n):
	inp = input()
	inp = inp.split()
	zn = inp[0]
	c = int(inp[1])
	if zn == '+':
		x += c
	elif x - c < 0:
		gr += 1
	else:
		x -= c
print(x, gr)


(n, x) = map(int, input().split(' '))
sad = 0
for i in range(0, n, 1):
	(si, nu) = input().split(' ')
	num = int(nu)
	if si == '+':
		x += num
	elif si == '-' and x >= num:
		x -= num
	else:
		sad += 1
print(x, sad)


import math

def get_primes(prime_supr):
	is_prime = [0] * 2 + [1] * prime_supr
	for i in range(2, int(math.sqrt(prime_supr)) + 1):
		if is_prime[i]:
			for j in range(i * i, prime_supr + 1, i):
				is_prime[j] = 0
	return is_prime
get_int = lambda : map(int, input().split())
(n, x) = get_int()
ans = 0
for i in range(n):
	(o, a) = input().split()
	if o == '+':
		x += int(a)
	elif x >= int(a):
		x -= int(a)
	else:
		ans += 1
print(x, ans)


(n, k) = map(int, input().split())
dist = 0
for _ in range(n):
	(t, add) = input().split()
	add = int(add)
	if t == '+':
		k += add
	elif k >= add:
		k -= add
	else:
		dist += 1
print(k, dist)


import math
(n, k) = map(int, input().split())
b = n // 1
s = 0
l = []
while n > 0:
	(x, y) = map(str, input().split())
	y = int(y)
	if x == '+':
		k = k + y
		s = s + 1
	if x == '-' and k >= y:
		k = k - y
		s = s + 1
	l.append(k)
	n = n - 1
print(k, b - s)


(n, x) = map(int, input().split())
angry = 0
for i in range(n):
	current = input().split()
	if current[0] == '+':
		x += int(current[1])
	elif x >= int(current[1]):
		x -= int(current[1])
	else:
		angry += 1
print(x, angry)


(numLine, iceCream) = map(int, input().split())
brats = 0
folks = []
for line in range(numLine):
	temp = []
	(a, b) = input().split()
	temp.append(a)
	temp.append(int(b))
	folks.append(temp)
for person in folks:
	if person[0] == '-':
		if iceCream - person[1] >= 0:
			iceCream = iceCream - person[1]
		else:
			brats += 1
	else:
		iceCream = iceCream + person[1]
print(str(iceCream) + ' ' + str(brats))


(a, b) = map(int, input().split())
ans = 0
while a:
	(d, e) = map(str, input().split())
	if d == '+':
		b += int(e)
	elif b >= int(e) and d == '-':
		b -= int(e)
	elif b < int(e):
		ans += 1
	a -= 1
print(b, ans)


(n, x) = map(int, input().split())
distress = 0
for y in range(n):
	(sign, num) = input().split()
	num = int(num)
	if sign == '-':
		if num <= x:
			x -= num
		else:
			distress += 1
	else:
		x += num
print(x, distress)


(n, d) = list(map(int, input().split()))
c = 0
for i in range(n):
	(r, p) = input().split()
	if r == '+':
		d += int(p)
	elif r == '-':
		if int(p) <= d:
			d -= int(p)
		else:
			c += 1
print(d, c)


x = list(map(int, input().split()))
n = x[0]
ice = x[1]
temp = []
dis = 0
for i in range(n):
	y = list(input().split())
	temp.append(y)
for i in temp:
	if i[0] == '-':
		if int(i[1]) <= ice:
			ice -= int(i[1])
		else:
			dis += 1
	else:
		ice += int(i[1])
print(str(ice) + ' ' + str(dis))


(n, x) = (int(i) for i in input().split())
dis = 0
ice = x
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		ice += b
	elif b > ice:
		dis += 1
	else:
		ice -= b
print('{} {}'.format(ice, dis))


(n, m) = map(int, input().split())
temp = 0
for i in range(n):
	(a, b) = input().split(maxsplit=1)
	if a == '+':
		m += int(b)
		continue
	if a == '-' and m >= int(b):
		m -= int(b)
	else:
		temp += 1
print(m, temp)


inn = list(map(int, input().split(' ')))
ops = inn[0]
icecrms = inn[1]
diskid = 0
for _ in range(ops):
	op = input().split(' ')
	if op[0] == '+':
		icecrms += int(op[1])
	elif int(op[1]) > icecrms:
		diskid += 1
	else:
		icecrms -= int(op[1])
print(icecrms, diskid)


(n, x) = map(int, input().split())
distressed = 0
rupee = 0
for i in range(n):
	s = input()
	rupee = int(s[2:len(s)])
	if s[0] == '+':
		x += rupee
	elif x < rupee:
		distressed += 1
	else:
		x -= rupee
print(x, distressed)


(a, b) = map(int, input().split())
x = 0
for i in range(a):
	(c, d) = map(str, input().split())
	d = int(d)
	if c == '+':
		b += d
	elif c == '-':
		if b < d:
			x += 1
		else:
			b -= d
print('{} {}'.format(b, x))


N = list(map(int, input().split()))
DIS = 0
for _ in range(N[0]):
	TMP = list(input().split())
	if '+' in TMP:
		N[1] += int(TMP[1])
	elif N[1] >= int(TMP[1]):
		N[1] -= int(TMP[1])
	else:
		DIS += 1
print(N[1], DIS)


(n, x) = map(int, input().split(' '))
X = []
for i in range(n):
	X.append(input().split(' '))
kids = 0
packs = x
for i in range(n):
	if X[i][0] == '+':
		packs = packs + int(X[i][1])
	elif X[i][0] == '-':
		packs = packs - int(X[i][1])
		if packs < 0:
			packs = packs + int(X[i][1])
			kids = kids + 1
print(' '.join([str(packs), str(kids)]))


(n, packsnum) = map(int, input().split())
remainingIceCream = 0
distressChilds = 0
icecreamPacks = 0
signs = []
packs = []
for i in range(n):
	(a, b) = map(str, input().split(' '))
	b = int(b)
	signs.append(a)
	packs.append(b)
for i in range(n):
	if signs[i] == '+':
		packsnum += packs[i]
	elif signs[i] == '-':
		if packsnum >= packs[i]:
			packsnum -= packs[i]
		else:
			distressChilds += 1
print(str(packsnum) + ' ' + str(distressChilds))


(a, b) = map(int, input().split())
ans1 = 0
for i in range(a):
	(x, z) = input().split()
	z = int(z)
	if x == '+':
		b += z
	elif x == '-':
		if b - z < 0:
			ans1 += 1
		else:
			b -= z
print(b, ans1)


def solve():
	(n, x) = map(int, input().split())
	distressed = 0
	for _ in range(n):
		(op, num) = input().split()
		if op == '+':
			x += int(num)
		elif int(num) <= x:
			x -= int(num)
		else:
			distressed += 1
	print(x, distressed)
solve()


(t, i) = map(int, input().split())
f = 0
for j in range(t):
	c = input().split()
	if c[0] == '+':
		s = int(c[1])
	else:
		s = -int(c[1])
	if i + s >= 0:
		i += s
	else:
		f += 1
		continue
print(i, end=' ')
print(f)


(n, x) = map(int, input().split())
rej = 0
for i in range(n):
	(op, ad) = input().split()
	if op == '+':
		x += int(ad)
	elif int(ad) > x:
		rej += 1
	else:
		x -= int(ad)
print(x, rej)


from collections import Counter

def solve():
	(a, b) = list(map(int, input().split()))
	count = 0
	for i in range(a):
		string = input().split(' ')
		if string[0] == '-':
			if b >= int(string[1]):
				b -= int(string[1])
			else:
				count += 1
		else:
			b += int(string[1])
	return (b, count)
val = solve()
print(val[0], val[1])


(a, b) = map(int, input().split())
nums = []
sign = []
sum = b
kids = 0
for i in range(a):
	(s, n) = map(str, input().split())
	if s == '+':
		sum += int(n)
	elif s == '-' and sum - int(n) >= 0:
		sum -= int(n)
	else:
		kids += 1
print(sum, kids)


(n, p) = map(int, input().split())
distress = 0
for _ in range(n):
	(sign, packs) = input().split()
	packs = int(packs)
	if sign == '+':
		p += packs
	elif packs <= p:
		p -= packs
	else:
		distress += 1
print(p, distress)


nums = list(map(int, input().split()))
n = nums[0]
icecream = nums[1]
children = 0
for i in range(n):
	st = input().split(' ')
	signal = st[0]
	new = int(st[1])
	if signal == '+':
		icecream += new
	if signal == '-':
		if new > icecream:
			children += 1
		else:
			icecream -= new
print(icecream, children)


(x, y) = map(int, input().split())
count = 0
for _ in range(x):
	(a, b) = map(str, input().split(' '))
	b = int(b)
	if a == '+':
		y = y + b
	elif a == '-':
		if y < b:
			count += 1
			continue
		else:
			y = y - b
print(y, count)


(n, x) = map(int, input().split())
count = x
dist = 0
for i in range(n):
	d = list(input())
	if d[0] == '+':
		count += int(''.join(d[2:]))
	if d[0] == '-':
		if int(''.join(d[2:])) > count:
			dist += 1
		if int(''.join(d[2:])) <= count:
			count -= int(''.join(d[2:]))
print(count, dist)


(n, p) = map(int, input().split())
cnt2 = 0
for _ in range(n):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		p += y
	elif p >= y:
		p -= y
	else:
		cnt2 += 1
print(p, cnt2)


(n, d) = map(int, input().split())
cry = 0
for i in range(n):
	(sign, num) = input().split()
	num = int(num)
	if sign == '+':
		d += num
	elif d >= num:
		d -= num
	else:
		cry += 1
print(d, cry)


li = list(map(int, input().split(' ')))
i = 0
c = 0
st = li[1]
while i < li[0]:
	fi = list(map(str, input().split(' ')))
	if fi[0] == '+':
		st = st + int(fi[1])
	if fi[0] == '-':
		if st >= int(fi[1]):
			st = st - int(fi[1])
		else:
			c = c + 1
	i = i + 1
print(st, c)


(n, x) = list(map(int, input().split()))
d = 0
for i in range(n):
	(p, ee) = list(map(str, input().split()))
	if p == '+':
		x += int(ee)
	elif p == '-' and int(ee) > x:
		d += 1
	else:
		x -= int(ee)
print(x, d)


(n, x) = map(int, input().strip().split())
r2 = 0
for i in range(0, n):
	q = input().strip().split()
	if q[0] == '+':
		x += int(q[1])
	elif int(q[1]) > x:
		r2 += 1
	else:
		x -= int(q[1])
print(x, r2)


(n, m) = [int(i) for i in input().split()]
g = 0
for i in range(n):
	a = input().split()
	if a[0] == '+':
		m += int(a[1])
	elif m - int(a[1]) >= 0:
		m -= int(a[1])
	else:
		g += 1
print(m, g)


s = input()
(n, m) = s.split()
n = int(n)
m = int(m)
ans1 = m
ans2 = 0
for i in range(n):
	s = input()
	(a, b) = s.split()
	b = int(b)
	if a is '+':
		ans1 += b
	elif ans1 < b:
		ans2 += 1
	else:
		ans1 -= b
print(ans1, ans2)


string = input().split(' ')
n = int(string[0])
x = int(string[1])
distress = 0
for i in range(n):
	string = input().split(' ')
	d = int(string[1])
	if string[0] == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		distress += 1
print(x, distress)


(n, x) = map(int, input().split(' '))
(carr, dis, a) = (x, 0, 0)
for i in range(n):
	s = input()
	a = int(s[2:])
	if s[0] == '+':
		carr += a
	elif s[0] == '-':
		if carr >= a:
			carr -= a
		else:
			dis += 1
print(carr, dis)


import sys

def inputs():
	return sys.stdin.readline()

def outputs(out):
	return sys.stdout.write(str(out))
(n, x) = map(int, inputs().split())
distress = 0
for _ in range(n):
	(need, cream) = map(str, inputs().split())
	if need == '+':
		x += int(cream)
	elif need == '-':
		if x - int(cream) >= 0:
			x -= int(cream)
		else:
			distress += 1
outputs(x)
outputs(' ')
outputs(distress)


def GetInt(NumberString):
	if NumberString[0] == '-':
		return int(NumberString[1:]) * -1
	else:
		return int(NumberString[1:])
Bounderies = str(input())
Bounderies = Bounderies.split(' ')
QueueSize = int(Bounderies[0])
IntialQuantity = int(Bounderies[1])
QueueMemberValue = []
for i in range(0, QueueSize):
	Inputt = str(input()).replace(' ', '')
	QueueMemberValue.append(GetInt(Inputt))
Quantity = IntialQuantity
DepressedKids = 0
for Member in QueueMemberValue:
	if Quantity + Member >= 0:
		Quantity = Quantity + Member
	else:
		DepressedKids = DepressedKids + 1
print(str(Quantity) + ' ' + str(DepressedKids))


numbers = input().split(' ')
total = int(numbers[1])
distressed = 0
for i in range(int(numbers[0])):
	customer = input().split(' ')
	if customer[0] == '+':
		total = total + int(customer[1])
	elif total >= int(customer[1]):
		total = total - int(customer[1])
	else:
		distressed = distressed + 1
print(total, distressed)


nx = input()
n = int(nx.split(' ')[0])
x = int(nx.split(' ')[1])
q = []
for i in range(n):
	q.append(input())
dis = 0
pl = x
for i in range(len(q)):
	curr = q[i].split(' ')
	if curr[0] == '-':
		if int(curr[1]) <= pl:
			pl = pl - int(curr[1])
		else:
			dis = dis + 1
	else:
		pl = pl + int(curr[1])
print(pl, dis)


(n, x) = map(int, input().split())
distressed = 0
for current in range(n):
	(sign, value) = input().split()
	value = int(value)
	if sign == '-':
		if value <= x:
			x -= value
		else:
			distressed += 1
	else:
		x += value
print(x, distressed)


(n, x) = map(int, input().split())
count = 0
while n:
	(a, b) = map(str, input().split())
	if a == '+':
		x += int(b)
	elif int(b) > x:
		count += 1
	else:
		x -= int(b)
	n -= 1
print(x, count)


a = input().split(' ')
n = int(a[0])
x = int(a[1])
b = 0
for i in range(0, n):
	d = input().split(' ')
	if d[0] == '+':
		x += int(d[1])
		continue
	if x >= int(d[1]) and d[0] == '-':
		x -= int(d[1])
	else:
		b += 1
print(x, b)


(x, d) = [int(i) for i in input().split()]
s = 0
n = 0
s = d
for i in range(x):
	(z, b) = [i for i in input().split()]
	if z == '+':
		s += int(b)
	elif z == '-':
		if int(b) <= s:
			s -= int(b)
		else:
			n += 1
print(s, n)


(N, X) = [int(x) for x in input().split()]
sadkids = 0
for i in range(N):
	query = input()
	if query[0] == '+':
		X += int(query[2:])
	elif int(query[2:]) > X:
		sadkids += 1
	else:
		X -= int(query[2:])
print(X, sadkids)


(n, x) = [int(x) for x in input().split()]
(ice_cream_left, kids_left_distressed) = (x, 0)
for _ in range(n):
	s = input().split()
	d = int(s[1]) * (-1 if s[0] == '-' else 1)
	if ice_cream_left + d < 0:
		kids_left_distressed += 1
	else:
		ice_cream_left += d
print(f'{ice_cream_left} {kids_left_distressed}')


(test, available_ice_cream) = map(int, input().split())
distress = 0
for _ in range(test):
	child_or_carier = int(input().replace(' ', ''))
	if child_or_carier >= 0:
		available_ice_cream += child_or_carier
	elif child_or_carier * -1 > available_ice_cream:
		distress += 1
	else:
		available_ice_cream += child_or_carier
print(f'{available_ice_cream} {distress}')


def FreeIceCream():
	(queue, stock) = map(int, input().strip().split())
	unhappy = 0
	for i in range(queue):
		(person, amount) = input().strip().split()
		amount = int(amount)
		if person == '+':
			stock += amount
		elif person == '-':
			unhappy += amount > stock
			stock -= (stock >= amount) * amount
	return (stock, unhappy)
a = FreeIceCream()
print(*a)


(n, x) = map(int, input().split())
l = []
while n:
	(s, d) = map(str, input().split())
	if s == '-':
		if x >= int(d):
			x = x - int(d)
		else:
			l.append(d)
	elif s == '+':
		x = x + int(d)
	n = n - 1
print(x, len(l))


(n, count) = map(int, input().split())
s = []
e = 0
for i in range(n):
	(r, f) = map(str, input().split())
	if r == '+':
		s.append(int(f))
	else:
		s.append(-1 * int(f))
for i in range(n):
	if s[i] >= 0:
		count += s[i]
	elif s[i] + count >= 0:
		count += s[i]
	else:
		e += 1
		pass
print(count, e)


(n, x) = input().split()
(n, x) = (int(n), int(x))
di = 0
for i in range(n):
	s = str(input())
	c = s[0]
	d = int(s[2:])
	if c == '+':
		x += d
	elif c == '-':
		if d > x:
			di += 1
		else:
			x -= d
print(x, di)


s = 0
(n, a) = [j for j in input().split()]
for i in range(int(n)):
	b = input()
	if eval(a + b) >= 0:
		a += b
	else:
		s += 1
print(eval(a), s)


(n, h) = [int(X) for X in input().split()]
c = 0
for I in range(n):
	(op, v) = [X for X in input().split()]
	v = int(v)
	d = {'+': h + v, '-': h - v}
	v = int(v)
	if op == '-' and h < v:
		c = c + 1
	else:
		h = d[op]
print(h, c)


(n, x) = map(int, input().split())
sad = 0
D = x
for i in range(n):
	s = list(input().split())
	(c, d) = (s[0], int(s[1]))
	if c == '+':
		D += d
	elif D >= d:
		D -= d
	else:
		sad += 1
print(D, sad)


i = input().split()
q = int(i[0])
x = int(i[1])
sadChild = 0
for j in range(q):
	next = input().split()
	newIceCream = int(next[1])
	if next[0] == '+':
		x = x + newIceCream
	elif x - newIceCream < 0:
		sadChild = sadChild + 1
	else:
		x = x - newIceCream
print(x, sadChild)


tmp = list(map(int, input().split()))
n = tmp[0]
resrv = tmp[1]
i = 0
for _ in range(n):
	r = input().split()
	if r[0] == '+':
		resrv += int(r[1])
	elif r[0] == '-':
		ned = int(r[1])
		if resrv >= ned:
			resrv -= ned
		else:
			i += 1
print(resrv, end=' ')
print(i)


l = list((int(x) for x in input().split()))
ice_cream = l[1]
c = 0
for i in range(l[0]):
	a = input().split()
	if a[0] == '+':
		ice_cream += int(a[1])
	elif ice_cream >= int(a[1]):
		ice_cream -= int(a[1])
	else:
		c += 1
		pass
print(ice_cream, c)


(n, x) = map(int, input().split())
i = 0
s = []
while i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		s.append(b)
	else:
		s.append(-1 * b)
	i += 1
left = x
dis = 0
for j in s:
	if j > 0:
		left += j
	elif abs(j) < left or abs(j) == left:
		left += j
	else:
		dis += 1
print(left, dis)


(queue_length, num_packs) = list(map(int, input().split()))
num_child_not_receive = 0
for i in range(queue_length):
	queue_i = int(input().replace(' ', ''))
	if queue_i + num_packs < 0:
		num_child_not_receive += 1
	else:
		num_packs += queue_i
print(num_packs, num_child_not_receive)


(n, c) = list(map(int, input().split()))
d = 0
for i in range(n):
	s = input()
	count = int(s[2:])
	if s[0] == '+':
		c += count
	elif count <= c:
		c -= count
	else:
		d += 1
print(c, d)


(x, y) = input().split()
x = int(x)
y = int(y)
count = y
child = 0
for i in range(0, x):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		count += b
	elif a == '-':
		count -= b
		if count < 0:
			count += b
			child += 1
print(count, child)


first = input().split(' ')
n = int(first[0])
x = int(first[1])
distrees = 0
for i in range(0, n):
	second = input().split(' ')
	c = second[0]
	num = int(second[1])
	if c == '+':
		x += num
	elif num <= x:
		x -= num
	else:
		distrees += 1
print(x, distrees)


x = [int(x) for x in input().split(' ')]
y = [[i for i in input().split(' ')] for j in range(x[0])]
sum2 = x[1]
distress = 0
for i in y:
	if i[0] == '+':
		sum2 += int(i[1])
	elif sum2 >= int(i[1]):
		sum2 -= int(i[1])
	else:
		distress += 1
print('{} {}'.format(sum2, distress))


(n, x) = input().split()
(n, x) = (int(n), int(x))
cv = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		x += b
	if a == '-':
		if x >= b:
			x -= b
		else:
			cv += 1
print(x, cv)


(n, x) = map(int, input().split())
stress = 0
for i in range(n):
	(d1, d2) = map(str, input().split())
	d2 = int(d2)
	if d1 == '+':
		x += d2
	elif d2 <= x:
		x -= d2
	else:
		stress += 1
print(x, stress)


(n, x) = map(int, input().split())
l = []
count = 0
for i in range(n):
	m = list(map(str, input().split()))
	l.append(m)
for i in range(n):
	if l[i][0] == '+':
		x = x + int(l[i][1])
	elif l[i][0] == '-':
		z = x - int(l[i][1])
		if z < 0:
			count = count + 1
		if z >= 0:
			x = z
print(x, end=' ')
print(count)


(n, k) = map(int, input().split())
dis = 0
for _ in range(n):
	s = input()
	if s[0] == '+':
		k += int(s[2:])
	elif k >= int(s[2:]):
		k -= int(s[2:])
	else:
		dis += 1
print(k, dis)


lt = list(input().split())
(n, packs) = (int(lt[0]), int(lt[1]))
kids = 0
while n != 0:
	n -= 1
	lt = list(input().split())
	if lt[0] == '+':
		packs += int(lt[1])
	else:
		lt[1] = int(lt[1])
		if lt[1] > packs:
			kids += 1
		else:
			packs -= lt[1]
print(packs, kids)


(n, x) = map(int, input().split())
c = 0
for i in range(n):
	(sign, no) = input().split()
	no = int(no)
	if sign == '+':
		x += no
	elif no > x:
		c += 1
	else:
		x -= no
print(x, c)


(n, d) = map(int, input().split())
sample = [['+', d]]
sum = 0
ans = 0
for i in range(n):
	(g, h) = input().split()
	sample.append([g, h])
for i in range(len(sample)):
	if sample[i][0] == '+':
		sum += int(sample[i][1])
	elif sample[i][0] == '-' and int(sample[i][1]) <= sum:
		sum -= int(sample[i][1])
	else:
		ans += 1
print(sum, ans)


str = input().split()
ice_cream = int(str[1])
disappointed_kids = 0
for i in range(int(str[0])):
	new_str = input().split()
	if new_str[0] == '+':
		ice_cream = ice_cream + int(new_str[1])
	if new_str[0] == '-':
		if ice_cream - int(new_str[1]) >= 0:
			ice_cream = ice_cream - int(new_str[1])
		else:
			disappointed_kids = disappointed_kids + 1
print(ice_cream, disappointed_kids)


(n, x) = map(int, input().split())
sad_children = 0
for i in range(n):
	(sign, number) = input().split()
	d = int(number)
	if sign == '+':
		x += d
	elif x < d:
		sad_children += 1
	else:
		x -= d
print(str(x) + ' ' + str(sad_children))


(n, x) = map(int, input().split())
ans = 0
for i in range(n):
	inp = input().split(' ')
	if inp[0] == '+':
		x += int(inp[1])
	elif x >= int(inp[1]):
		x -= int(inp[1])
	else:
		ans += 1
print(x, ans)


(n, x) = map(int, input().split())
count = 0
for y in range(n):
	s = input()
	c = s[0:1]
	d = int(s[2:])
	if c == '+':
		x += d
	elif c == '-':
		if x < d:
			count += 1
		else:
			x -= d
print(x, count)


(n, x) = map(int, input().split(' '))
distressed = 0
cur = x
for i in range(0, n):
	(act, d) = input().split(' ')
	d = int(d)
	if act == '+':
		cur += d
	elif d > cur:
		distressed += 1
	else:
		cur -= d
print('%i %i' % (cur, distressed))


(n, x) = map(int, input().split())
a = []
b = []
count = 0
for i in range(n):
	s = list(map(str, input().split()))
	a.append(s)
	if a[i][0] == '+':
		b.append(int(a[i][1]))
	else:
		b.append(-int(a[i][1]))
for i in range(len(b)):
	if x + b[i] >= 0:
		x = x + b[i]
	else:
		x = x
		count = count + 1
print(x, count)


def solve(n=5, x=7):
	fail = 0
	for i in range(n):
		(a, b) = str(input()).split(' ')
		c = int(a + b)
		if x + c < 0:
			fail += 1
		else:
			x += c
	return (x, fail)
(a, b) = str(input()).split(' ')
(x, fail) = solve(int(a), int(b))
print(x, fail)


def solve(n, x, o):
	d = 0
	for (s, v) in o:
		if s == '-':
			if x - v >= 0:
				x -= v
			else:
				d += 1
		else:
			x += v
	return (x, d)

def main():
	(n, x) = list(map(int, input().split()))
	o = []
	for _ in range(n):
		(s, v) = input().split()
		o.append((s, int(v)))
	print(*solve(n, x, o))
main()


(a, b) = input().split()
a = int(a)
b = int(b)
count = 0
count = int(count)
for i in range(0, a):
	(symbol, val) = input().split()
	val = int(val)
	if symbol == '+':
		b = b + val
	elif symbol == '-':
		if b >= val:
			b = b - val
		else:
			count = count + 1
print(b, count, sep=' ')


n = list(map(int, input().split()))
sum = n[1]
dis = 0
for i in range(n[0]):
	x = list(map(str, input().split()))
	if x[0] == '+':
		sum += int(x[1])
	elif x[0] == '-' and sum >= int(x[1]):
		sum -= int(x[1])
	elif x[0] == '-' and sum < int(x[1]):
		dis += 1
print(sum, dis)


def main():
	(npeople, npacks) = map(int, input().split())
	giver_and_receiver = [tuple(input().split()) for person in range(npeople)]

	def ice_cream(npacks, giver_and_receiver):
		distressed_kids = 0
		for person in giver_and_receiver:
			(sign, request) = (person[0], int(person[1]))
			if sign == '+':
				npacks += request
			elif npacks >= request:
				npacks -= request
			else:
				distressed_kids += 1
		return (npacks, distressed_kids)
	(npacks, distressed_kids) = ice_cream(npacks, giver_and_receiver)
	print(f'{npacks} {distressed_kids}')
main()


def main():
	(n, m) = [int(v) for v in input().split()]
	vals = [input() for v in range(n)]
	c = m
	d = 0
	for v in vals:
		data = v.split()
		if data[0] == '+':
			c += int(data[1])
		elif int(data[1]) <= c:
			c -= int(data[1])
		else:
			d += 1
	print(c, d)
main()


(a, b) = list(map(int, input().split()))
sum1 = b
count = 0
for i in range(a):
	s = input().rstrip()
	if s[0] == '+':
		sum1 += int(s[2:])
	elif sum1 >= int(s[2:]):
		sum1 -= int(s[2:])
	else:
		count += 1
print(sum1, count)


m1 = 'abcdefghijklmnopqrstuvwxyz'
m2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
cond = ['No', 'Yes']
Cond = ['NO', 'YES']
ct = 0
(n, x) = map(int, input().split())
for i in range(n):
	(c, tmp) = input().split()
	tmp = int(tmp)
	if c == '+':
		x += tmp
		continue
	elif tmp <= x:
		x -= tmp
		continue
	else:
		ct += 1
print(str(x) + ' ' + str(ct))


import sys
(n, x) = map(int, input().split())
packs = x
d_kids = 0
for _ in range(n):
	(char, d) = sys.stdin.readline().split()
	if char == '+':
		packs += int(d)
	elif char == '-':
		if packs >= int(d):
			packs -= int(d)
		else:
			d_kids += 1
print(packs, d_kids)


(n, m) = map(int, input().split())
d = []
distressed = 0
for i in range(n):
	a = input()
	d.append(a)
for i in range(len(d)):
	z = int(d[i][2:])
	if d[i][0] == '+':
		m = m + z
	elif m - z >= 0:
		m = m - z
	else:
		distressed = distressed + 1
print(m, distressed)


f = lambda : map(int, input().split())
(n, s) = f()
c = 0
while n:
	a = int(input().replace(' ', ''))
	if s < -a:
		c += 1
	else:
		s += a
	n -= 1
print(s, c)


(n, d) = [int(i) for i in input().split()]
y = 0
for i in range(n):
	x = input().split()
	if x[0] == '+':
		p = int(x[1])
		d = d + p
	else:
		p = int(x[1])
		if d >= p:
			d = d - p
		else:
			y = y + 1
print(d, y)


(n, x) = map(int, input().split())
b = []
k = 0
for i in range(n):
	a = list(input().split())
	b.append(a)
for i in b:
	if i[0] == '+':
		x += int(i[1])
	if i[0] == '-':
		if int(i[1]) > x:
			k += 1
		else:
			x -= int(i[1])
print(x, k)


(t, n) = map(int, input().split())
(kid, ice) = (0, 0)
for i in range(t):
	(st, va) = input().split()
	if st == '-':
		if int(va) <= n:
			n -= int(va)
		else:
			kid += 1
	else:
		n += int(va)
print(n, kid)


(n, x) = map(int, input().split())
ziqi = 0
for i in range(n):
	(pm, d) = map(str, input().split())
	d = int(d)
	if pm == '+':
		x += d
	elif pm == '-' and x >= d:
		x -= d
	else:
		ziqi += 1
print(x, ziqi)


import sys
(m, n) = input().split()
d = int(n)
e = int(m)
c = 0
i = 0
for i in range(0, e):
	x = input()
	x = x.replace(' ', '')
	if x[0] == '+':
		d = d + int(x)
	else:
		o = d + int(x)
		if o < 0:
			c += 1
		else:
			d = o
print(d, c)


a = [int(i) for i in input().split()]
s = 0
for i in range(a[0]):
	b = input().split()
	if b[0] == '+':
		a[1] += int(b[1])
	elif a[1] >= int(b[1]):
		a[1] -= int(b[1])
	else:
		s += 1
print(a[1], s)


line1 = [int(x) for x in input().split()]
kids = 0
for i in range(line1[0]):
	line2 = input().split()
	x = int(line2[1])
	if line2[0] == '+':
		line1[1] += x
	elif x <= line1[1]:
		line1[1] -= x
	else:
		kids += 1
print(line1[1], kids)


(n, cur) = map(int, input().split())
cnt = 0
for i in range(n):
	(pn, ted) = input().split()
	ted = int(ted)
	if pn == '+':
		cur += ted
	elif cur >= ted:
		cur -= ted
	else:
		cnt += 1
print(cur, cnt)


(n, x) = map(int, input().split())
have = x
dis = 0
for _ in range(n):
	(ch, i) = input().split()
	i = int(i)
	if ch == '+':
		have += i
	elif i <= have:
		have -= i
	else:
		dis += 1
print(have, dis)


n = input()
n = n.replace('\r', '')
(n, x) = n.split(' ', 2)
n = int(n)
x = int(x)
s = x
ans = 0
while n > 0:
	n -= 1
	t = input()
	t = t.replace(' ', '')
	t = int(t)
	if s + t >= 0:
		s = s + t
	else:
		ans += 1
print(s, ans)


(n, x) = map(int, input().split())
deP = 0
for i in range(n):
	s = input().split()
	sign = s[0]
	number = int(s[1])
	if sign == '+':
		x += number
	elif number > x:
		deP += 1
	else:
		x -= number
print(f'{x} {deP}')


(n, x) = input().split()
n = int(n)
x = int(x)
distress = 0
for i in range(n):
	(c, d) = input().split()
	d = int(d)
	if c == '+':
		x += d
	if c == '-':
		if d > x:
			distress += 1
		else:
			x -= d
print(x, distress)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def count_moves(n, name):
	mvs = 0
	cnt = 0
	for i in range(n):
		if name[i] == 'x':
			cnt += 1
		else:
			mvs += max(0, cnt - 2)
			cnt = 0
	mvs += max(0, cnt - 2)
	return mvs
t = 1
while t:
	t = t - 1
	(k, g) = (0, 0)
	points = []
	(n, x) = map(int, input().split())
	while n:
		n -= 1
		(c, a) = map(str, input().split())
		a = int(a)
		if c == '+':
			x += a
		elif x < a:
			g += 1
		else:
			x -= a
	k = x
	print(k, g)


(a, b) = map(int, input().split())
distress = 0
for _ in range(a):
	(sign, val1) = map(str, input().split())
	val = int(val1)
	if sign == '+':
		b = b + val
	if sign == '-':
		if b - val >= 0:
			b = b - val
		else:
			distress = distress + 1
print(b, distress)


(n, x) = input().split()
n = int(n)
x = int(x)
number_distressed = 0
for i in range(0, n):
	a = input().split()
	if a[0] == '+':
		x += int(a[1])
	elif int(a[1]) <= x:
		x -= int(a[1])
	else:
		number_distressed += 1
print(str(x) + ' ' + str(number_distressed))


(n, x) = map(int, input().split())
cnt = 0
for _ in range(n):
	k = input().split()
	p = int(k[1])
	if k[0] == '+':
		x += p
	elif x < p:
		cnt += 1
	else:
		x -= p
print(x, cnt)


(x, n) = map(int, input().split())
count = 0
for i in range(x):
	(A, m) = input().split()
	m = int(m)
	if A == '+':
		n = n + m
	elif A == '-' and m <= n:
		n = n - m
	elif m > n and A == '-':
		count = count + 1
print(n, count)


class CodeforcesTask686ASolution:

	def __init__(self):
		self.result = ''
		self.n_x = []
		self.operations = []

	def read_input(self):
		self.n_x = [int(x) for x in input().split(' ')]
		for x in range(self.n_x[0]):
			self.operations.append(int(input().replace(' ', '')))

	def process_task(self):
		ice = self.n_x[1]
		distress = 0
		for op in self.operations:
			if op >= 0:
				ice += op
			elif abs(op) > ice:
				distress += 1
			else:
				ice += op
		self.result = '{0} {1}'.format(ice, distress)

	def get_result(self):
		return self.result
Solution = CodeforcesTask686ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, x) = map(int, input().split())
distressed = 0
while n > 0:
	n -= 1
	(sign, amount) = input().split(' ')
	amount = int(amount)
	if sign == '+':
		x += amount
	elif x < amount:
		distressed += 1
	else:
		x -= amount
print(x, distressed)


(n, s) = map(int, input().split())
t = 0
for i in range(n):
	(z, num) = input().split()
	num = int(num)
	if z == '-':
		if num > s:
			t += 1
		else:
			s -= num
	elif z == '+':
		s += num
print(s, t)


(n, x) = [int(y) for y in input().split(' ')]
d = 0
for nn in range(n):
	(p, q) = [y for y in input().split(' ')]
	if p == '+':
		x += int(q)
	else:
		q = int(q)
		if q > x:
			d += 1
		else:
			x -= q
print(x, d)


(n, x) = map(int, input().split())
child = 0
for i in range(n):
	(sym, amount) = map(str, input().split())
	if sym == '+':
		x += int(amount)
	elif x - int(amount) < 0:
		child += 1
	else:
		x -= int(amount)
print(x, child)


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	(char, num) = input().split()
	if char == '+':
		x += int(num)
	elif int(num) > x:
		count += 1
	else:
		x -= int(num)
print('{} {}'.format(x, count))


(n, x) = map(int, input().split())
xx = 0
for _ in range(n):
	s = str(input()).split()
	if s[0] == '+':
		x += int(s[1])
	elif x >= int(s[1]):
		x -= int(s[1])
	else:
		xx += 1
print(x, xx)


text = input()
n = int(text.split(' ')[0])
x = int(text.split(' ')[1])
count = 0
for i in range(0, n):
	text = input()
	t = text.split(' ')
	if t[0] == '-':
		if x >= int(t[1]):
			x -= int(t[1])
		else:
			count += 1
	elif t[0] == '+':
		x += int(t[1])
print(x, count)


(n, init) = map(int, input().split())
count_ = 0
for i in range(n):
	arr = list(map(str, input().split()))
	if arr[0] == '+':
		init += int(arr[1])
	elif int(arr[1]) <= init:
		init -= int(arr[1])
	else:
		count_ += 1
print(init, count_)


def icecream(s, a):
	c = s
	d = 0
	for j in a:
		if j[0] == '+':
			c += int(j[1])
		elif c >= int(j[1]):
			c -= int(j[1])
		else:
			d += 1
	return str(c) + ' ' + str(d)
n = list(map(int, input().split()))
ar = []
for i in range(n[0]):
	ar.append(list(input().split()))
print(icecream(n[1], ar))


n_x = input().split(' ')
n = int(n_x[0])
x = int(n_x[1])
distressed_kids = 0
total = x
for i in range(n):
	input_packs = input().split(' ')
	packs = int(input_packs[1])
	packs_type = input_packs[0]
	if packs_type == '+':
		total += packs
	elif total < packs:
		distressed_kids += 1
	else:
		total -= packs
print('{} {}'.format(total, distressed_kids))


distress = 0
(n, x) = map(int, input().split())
while n:
	(oper, num) = map(str, input().split())
	if oper == '+':
		x += int(num)
	else:
		p = x
		x -= int(num)
		if x < 0:
			distress += 1
			x = p
	n -= 1
print(x, distress, sep=' ')


(a, b) = map(int, input().split())
r = 0
for i in range(a):
	(p, q) = map(str, input().split())
	if p == '+':
		b += int(q)
	else:
		z = int(q)
		if z <= b:
			b -= z
		else:
			r += 1
print(b, r)


inp = lambda : input().split(' ')
arr = inp()
x = int(arr[1])
ng = 0
for i in range(int(arr[0])):
	a = inp()
	if a[0] == '+':
		x += int(a[1])
	elif a[0] == '-':
		if int(a[1]) <= x:
			x -= int(a[1])
		else:
			ng += 1
print(x, ng)


b = list(map(int, input().split()))
a = []
(d, count) = (b[1], 0)
for x in range(b[0]):
	a.append(input().split())
for x in range(len(a)):
	if a[x][0] == '+':
		d += int(a[x][1])
	elif a[x][0] == '-':
		if d - int(a[x][1]) >= 0:
			d += -int(a[x][1])
		else:
			count += 1
print(d, count, sep=' ')


import math, fractions
(t, ice) = [int(x) for x in input().split()]
d = 0
for _ in range(t):
	(a, b) = input().split()
	a = str(a)
	b = int(b)
	if a == '+':
		ice += b
	elif ice - b >= 0:
		ice -= b
	else:
		d += 1
print(ice, d)


(n, x) = map(int, input().split())
diss = 0
for i in range(n):
	(p, q) = input().split()
	q = int(q)
	if p == '+':
		x += q
	elif p == '-' and x >= q:
		x -= q
	else:
		diss += 1
		continue
print(x, diss)


c = 0
a = input().split(' ')
a = list(map(int, a))
(n, x) = a
c = 0
for i in range(n):
	q = input().split(' ')
	if q[0] == '+':
		x = x + int(q[1])
	elif x >= int(q[1]):
		x = x - int(q[1])
	else:
		c += 1
print(x, c, end=' ')


(n, x) = input().split()
(n, x) = (int(n), int(x))
distress = 0
for each_n in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		x += b
	elif b <= x:
		x -= b
	else:
		distress += 1
print(x, distress)


__author__ = 'artyom'

def main():
	(n, x) = read(3)
	c = 0
	for i in range(n):
		a = read(2)
		v = int(a[1])
		if a[0] == '+':
			x += v
		elif v > x:
			c += 1
		else:
			x -= v
	return (x, c)

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(main())


(n, amount) = map(int, input().split())
distress = 0
for i in range(n):
	(c, d) = input().split()
	d = int(d)
	if c == '+':
		amount += d
	elif c == '-':
		if d > amount:
			distress += 1
		else:
			amount -= d
print(amount, distress)


(n, x) = map(int, input().split())
d = 0
for loop in range(n):
	(s, m) = input().split()
	m = int(m)
	if s == '+':
		x += m
	elif m > x:
		d += 1
	else:
		x -= m
print(str(x) + ' ' + str(d))


nandx = input().split()
n = int(nandx[0])
x = int(nandx[1])
candy = x
skid = 0
for i in range(n):
	oppandam = input().split()
	opp = str(oppandam[0])
	am = int(oppandam[1])
	if opp == '-':
		if candy < am:
			skid += 1
		else:
			candy -= am
	elif opp == '+':
		candy += am
print(candy, skid)


inp = list(map(int, input().split()))
tCases = inp[0]
iceCream = inp[1]
store = []
distress = 0
for x in range(tCases):
	temp = list(input().split())
	store.append(temp)
for x in store:
	if x[0] == '-':
		if int(x[1]) <= iceCream:
			iceCream -= int(x[1])
		else:
			distress += 1
	else:
		iceCream += int(x[1])
print(str(iceCream) + ' ' + str(distress))


(n, m) = map(int, input().split())
no_child = 0
for i in range(n):
	k = list(map(str, input().split()))
	if k[0] == '-':
		if int(k[1]) > m:
			no_child += 1
		else:
			m -= int(k[1])
	else:
		m += int(k[1])
print(m, no_child)


(n, m) = list(map(int, input().split()))
count = 0
for i in range(n):
	p = list(input().split())
	if p[0] == '+':
		m = m + int(p[1])
	elif p[0] == '-':
		if int(p[1]) <= m:
			m = m - int(p[1])
		elif int(p[1]) > m:
			count += 1
print(m, count)


def main():
	[n, x] = [int(_) for _ in input().split()]
	n_distressed = 0
	for _ in range(n):
		s = input().split()
		events = [s[0], int(s[1])]
		if events[0] == '+':
			x += events[1]
		elif events[1] > x:
			n_distressed += 1
		else:
			x -= events[1]
	print(x, n_distressed)
main()


(n, x) = map(int, input().split())
count = 0
for i in range(n):
	(sign, packs) = input().split()
	packs = int(packs)
	if sign == '+':
		x += packs
	elif sign == '-' and x < packs:
		count += 1
	else:
		x -= packs
print(x, count)


(n, d) = map(int, input().split())
kid = 0
i = 0
while i < n:
	(op, di) = input().split()
	di = int(di)
	if op == '+':
		d += di
	elif d >= di:
		d -= di
	else:
		kid += 1
	i += 1
print(d, kid)


arr = list(map(int, input().rstrip().split()))
disressKid = 0
leftIce = arr[1]
for _ in range(arr[0]):
	s = input()
	if s[0] == '+':
		leftIce += int(s[2:])
	elif leftIce >= int(s[2:]):
		leftIce -= int(s[2:])
	else:
		disressKid += 1
print(str(leftIce) + ' ' + str(disressKid))


C = 0
(n, d) = map(int, input().split())
for i in range(n):
	l = [*map(str, input().split())]
	if l[0] == '+':
		d += int(l[1])
	elif d - int(l[1]) < 0:
		C += 1
	else:
		d -= int(l[1])
print(d, C)


(n, x) = map(int, input().split())
t = 0
for _ in range(n):
	(op, d) = input().split()
	if op == '+':
		x += int(d)
	elif x >= int(d):
		x -= int(d)
	else:
		t += 1
print(str(x) + ' ' + str(t))


x = list(map(int, input().strip().split()))
untreated = 0
remaining = x[1]
for i in range(x[0]):
	temp = list(map(str, input().strip().split()))
	if temp[0] == '+':
		remaining += int(temp[1])
	elif remaining - int(temp[1]) < 0:
		untreated += 1
	else:
		remaining -= int(temp[1])
print(str(remaining) + ' ' + str(untreated))


(n, packs) = tuple(map(int, input().split()))
children = 0
for i in range(n):
	(t, d) = input().split()
	d = int(d)
	if t == '+':
		packs += d
	elif d <= packs:
		packs -= d
	else:
		children += 1
print(str(packs) + ' ' + str(children))


(tp, ice) = map(int, input().split())
distress = 0
for i in range(tp):
	(a, b) = input().split()
	if a == '+':
		ice += int(b)
	elif int(b) <= ice:
		ice -= int(b)
	else:
		distress += 1
print(ice, distress)


(n, m) = map(int, input().split())
l = [input() for i in range(n)]
c = 0
for i in l:
	(a, d, *b) = i
	b = int(''.join(b))
	if a == '+':
		m += int(b)
	elif m - int(b) < 0:
		c += 1
	else:
		m -= int(b)
print(m, c)


(n, x) = map(int, input().split())
distressedKids = 0
while n > 0:
	lst = [str(x) for x in input().split()]
	amount = int(''.join(lst[1:]))
	if lst[0] == '+':
		x = x + amount
	elif x - amount >= 0:
		x = x - amount
	else:
		distressedKids = distressedKids + 1
	n = n - 1
print(x, distressedKids)


(n, x) = map(int, input().split())
lst = list()
total_pack = x
distress_kid = 0
for i in range(n):
	lst.append(input().split())
for item in lst:
	if item[0] == '+':
		total_pack = total_pack + int(item[1])
	elif total_pack >= int(item[1]):
		total_pack = total_pack - int(item[1])
	else:
		distress_kid += 1
print(total_pack, distress_kid)


(z, r) = (0, 0)
(n, x) = (int(l) for l in input().split())
while r < n:
	r = r + 1
	d = input()
	if d[0] == '+':
		d = int(d[2:])
		x = x + d
	else:
		d = int(d[2:])
		if d > x:
			z = z + 1
		else:
			x = x - d
print(str(x) + ' ' + str(z))


def iceCreamLine(queue, currentIceCream):
	totalIcecream = currentIceCream
	unsatisfiedCustomers = 0
	for person in queue:
		if str(person[0]) == '+':
			totalIcecream += int(person[1])
			continue
		if str(person[0]) == '-':
			if totalIcecream >= int(person[1]):
				totalIcecream -= int(person[1])
			else:
				unsatisfiedCustomers += 1
				continue
	return [totalIcecream, unsatisfiedCustomers]
nums = input().split()
queue = []
for i in range(int(nums[0])):
	person = input().split()
	queue.append(person)
packet = iceCreamLine(queue, int(nums[1]))
print(str(packet[0]) + ' ' + str(packet[1]))


(n, x) = map(int, input().split())
upset = 0
for i in range(n):
	(trade, amount) = input().split()
	amount = int(amount)
	if trade == '+':
		x += amount
	elif amount <= x:
		x -= amount
	else:
		upset += 1
print(x, upset)


(a, b) = map(int, input().split())
d = 0
for _ in range(a):
	s = list(map(str, input().split()))
	if s[0] == '+':
		b += int(s[1])
	elif b >= int(s[1]):
		b -= int(s[1])
	else:
		d += 1
print(b, d)


(queue, initial) = list(map(int, input().split()))
distress = 0
for x in range(queue):
	ca = list(input().split())
	if ca[0] == '+':
		initial += int(ca[1])
	if ca[0] == '-' and int(ca[1]) > initial:
		distress += 1
	if ca[0] == '-' and int(ca[1]) <= initial:
		initial -= int(ca[1])
print(initial, distress)


(n, available_ice_cream) = map(int, input().split())
lines = []
for i in range(n):
	(sign, ice_cream_amount) = input().split()
	ice_cream_amount = int(ice_cream_amount)
	lines.append([sign, ice_cream_amount])
distress_kids = 0
for i in lines:
	if i[0] == '+':
		available_ice_cream += i[1]
	if i[0] == '-':
		if available_ice_cream - i[1] >= 0:
			available_ice_cream -= i[1]
		else:
			distress_kids += 1
print(available_ice_cream, distress_kids)


Line1 = input('')
Parameter = list(map(int, Line1.split()))
N = Parameter[0]
Ini = Parameter[1]
Elem = []
for itr in range(0, N):
	curr = input('')
	curr_elem = curr.split(' ')
	Elem.append((curr_elem[0], int(curr_elem[1])))
curr_sum = Ini
distress = 0
for j in range(0, N):
	if Elem[j][0] == '+':
		curr_sum += Elem[j][1]
	elif Elem[j][0] == '-':
		if Elem[j][1] <= curr_sum:
			curr_sum -= Elem[j][1]
		elif Elem[j][1] > curr_sum:
			distress += 1
print(curr_sum, distress)


(n, x) = map(int, input().split())
c = 0
for i in range(n):
	(a, b) = map(str, input().split())
	if a == '-' and x - int(b) < 0:
		c = c + 1
		continue
	elif a == '+':
		x = x + int(b)
	elif a == '-':
		x = x - int(b)
print(x, c)


s1 = input()
l = list(map(int, s1.split(' ')))
(n, x) = (l[0], l[1])
(a1, a2) = (x, 0)
for i in range(n):
	s = input().split(' ')
	if s[0] == '+':
		a1 += int(s[1])
	else:
		y = int(s[1])
		if a1 >= y:
			a1 -= y
		else:
			a2 += 1
print(str(a1) + ' ' + str(a2))


(n, x) = map(int, input().split(' '))
distress = 0
while n > 0:
	d = input()
	if d[:1] == '+':
		x += int(d[2:])
	elif x - int(d[2:]) >= 0:
		x -= int(d[2:])
	else:
		distress += 1
	n -= 1
print(x, distress)


(n, x) = map(int, input().split())
count = 0
for _ in range(n):
	(oper, d) = input().split()
	d = int(d)
	if oper == '+':
		x += d
	elif oper == '-' and x >= d:
		x -= d
	else:
		count += 1
print(x, count)


(n, x) = map(int, input().split())
cnt = 0
for t in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		x = x + b
	elif x - b >= 0:
		x = x - b
	else:
		cnt += 1
print(x, cnt)


s = input().split()
n = int(s[0])
x = int(s[1])
cnt = 0
for _ in range(n):
	s = input().split()
	if s[0] == '+':
		x += int(s[1])
	else:
		d = int(s[1])
		if x >= d:
			x -= d
		else:
			cnt += 1
print('{} {}'.format(x, cnt))


(noOfPeopleInQueue, noOfIcecreamsTheyHave) = [int(x) for x in input().split(' ')]
noOfKidsGoBackDisstressed = 0
for i in range(noOfPeopleInQueue):
	(icecreamsIncomingOrOutgoing, noOfIcecreams) = input().split(' ')
	if icecreamsIncomingOrOutgoing == '+':
		noOfIcecreamsTheyHave += int(noOfIcecreams)
	elif icecreamsIncomingOrOutgoing == '-':
		if noOfIcecreamsTheyHave >= int(noOfIcecreams):
			noOfIcecreamsTheyHave -= int(noOfIcecreams)
		else:
			noOfKidsGoBackDisstressed += 1
print(noOfIcecreamsTheyHave, noOfKidsGoBackDisstressed)


(n, x) = map(int, input().split(' '))
distressedKids = 0
for i in range(n):
	(operator, icecream) = input().split(' ')
	if operator == '+':
		x += int(icecream)
	elif int(icecream) > x:
		distressedKids += 1
	else:
		x -= int(icecream)
print(x, distressedKids)


(n, x) = map(int, input().split())
d = 0
for i in range(n):
	(am, c) = input().split()
	if am == '+':
		x += int(c)
	elif x >= int(c):
		x -= int(c)
	else:
		d += 1
print(x, end=' ')
print(d)


(x, y) = input().split(' ')
a = (x, y)
a = list(a)
for i in range(len(a)):
	a[i] = int(a[i])
count = 0
num = a[1]
for i in range(a[0]):
	(z, f) = input().split(' ')
	char = z
	inp = int(f)
	if char == '+':
		num = num + inp
	elif char == '-':
		num = num - inp
		if num < 0:
			count += 1
			num = num + inp
print(num, count)


(n, counter) = map(int, input().split(' '))
distress = 0
for i in range(n):
	(i, j) = input().split(' ')
	j = int(j)
	if i == '+':
		counter += j
	elif j <= counter:
		counter -= j
	else:
		distress += 1
print('{} {}'.format(counter, distress))


(n, x) = map(int, input().split())
packs = x
distress = 0
for i in range(n):
	s = input().split()
	if s[0] == '+':
		packs = packs + int(s[1])
	elif s[0] == '-' and packs >= int(s[1]):
		packs = packs - int(s[1])
	else:
		distress += 1
print(packs, distress)


first_line = input().split()
n = int(first_line[0])
x = int(first_line[1])
stock = x
disapp = 0
for i in range(n):
	order = input().split()
	order_amt = int(order[1])
	if order[0] == '-':
		if stock - order_amt < 0:
			disapp += 1
		else:
			stock -= order_amt
	else:
		stock += order_amt
print(stock, disapp)


(n, x) = [int(x) for x in input().split()]
count = 0
for i in range(n):
	(sign, num) = input().split()
	num = int(num)
	if sign == '+':
		x += num
	elif sign == '-':
		if x < num:
			count += 1
		else:
			x -= num
print(x, count)


(a, b) = map(int, input().split())
cont = 0
for k in range(a):
	s = input().split()
	if s[0] == '+':
		b += int(s[1])
	elif int(s[1]) <= b:
		b -= int(s[1])
	else:
		cont += 1
print(b, cont)


(n, x) = map(int, input().split())
k = 0
for i in range(n):
	(sign, qua) = input().split()
	qua = int(qua)
	if sign == '+':
		x += qua
	elif x < qua:
		k += 1
	else:
		x -= qua
print(x, k)


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
(n, x) = R()
cnt = 0
for i in range(n):
	(s, d) = input().split()
	d = int(d)
	if s == '+':
		x += d
	elif x >= d:
		x -= d
	else:
		cnt += 1
print(x, cnt)


inp = list(map(int, input().split()))
l = [list(map(str, input().split())) for i in range(inp[0])]
c = inp[1]
k = 0
for i in range(len(l)):
	if l[i][0] == '+':
		c = c + int(l[i][1])
	elif l[i][0] == '-' and c < int(l[i][1]):
		k = k + 1
	else:
		c = c - int(l[i][1])
print(c, k, sep=' ')


def num(str):
	n = 0
	for i in str:
		if i.isnumeric():
			n = n * 10 + int(i)
	return n
(n, x) = map(int, input().strip().split())
d = 0
y = 0
for i in range(n):
	str = input()
	if str[0] == '+':
		x += num(str)
	else:
		y = x - num(str)
		if y >= 0:
			x = x - num(str)
		else:
			d += 1
print(x, d)


(n, x) = map(int, input().split())
t = 0
for i in range(n):
	(s, v) = input().split()
	v = int(v)
	if s == '-':
		v = -v
	if x + v >= 0:
		x += v
	else:
		t += 1
print(x, t)


(n, x) = list(map(int, input().split()))
(u, t) = (x, 0)
for i in range(n):
	a = input().split(' ')
	if a[0] == '+':
		u += int(a[1])
	elif a[0] == '-':
		if u >= int(a[1]):
			u -= int(a[1])
		else:
			t += 1
print(u, t)


str0 = [int(i) for i in input().split()]
list0 = []
for i in range(str0[0]):
	list0.append(input().split())
icecreams = str0[1]
counter = 0
for i in list0:
	if i[0] == '+':
		icecreams += int(i[1])
	elif int(i[1]) <= icecreams:
		icecreams -= int(i[1])
	else:
		counter += 1
print(icecreams, counter)


(n, x) = map(int, input().split())
amount = x
kid = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		amount += b
	elif amount >= b:
		amount -= b
	else:
		kid += 1
print(amount, kid)


a = input().split()
kids = int(a[0])
ice_cream = int(a[1])
counter = 0
for i in range(kids):
	b = int(input().replace(' ', ''))
	ice_cream = ice_cream + b
	if ice_cream < 0:
		counter += 1
		ice_cream -= b
print(ice_cream, counter)


(n, x) = list(map(int, input().split()))
n_bosy = 0
for i in range(n):
	(s, d) = input().split()
	if s == '+':
		x += int(d)
	elif abs(int(d)) > x:
		n_bosy = n_bosy + 1
	else:
		x -= abs(int(d))
print(f'{x} {n_bosy}')


import sys

def toint(s):
	res = 0
	for i in s:
		res *= 10
		res += ord(i) - ord('0')
	return res
(n, x) = map(int, sys.stdin.readline().split())
child = 0
for i in range(n):
	(op, amount) = sys.stdin.readline().split()
	amount = toint(amount)
	if op == '+':
		x += amount
	elif amount > x:
		child += 1
	else:
		x -= amount
print(x, child)


(n, x) = [int(x) for x in input().split()]
g = 0
for i in range(n):
	s = input()
	d = True
	if s[0] == '-':
		d = False
	s = int(s[2:])
	if d:
		x += s
	elif x >= s:
		x -= s
	else:
		g += 1
print(x, g)


(n, x) = map(int, input().split())
a = []
c = x
dis = 0
for i in range(n):
	s = input()
	a.append(s)
for i in range(len(a)):
	t = a[i]
	t1 = int(t[2:])
	if t[0] == '+':
		c = c + t1
	if t[0] == '-':
		if c - t1 < 0:
			dis = dis + 1
		else:
			c = c - t1
print(c, dis)


(n, x) = map(int, input().strip().split())
distress = 0
for i in range(n):
	(a, b) = map(str, input().strip().split())
	b = int(b)
	if a == '-' and x >= b:
		x -= b
	elif a == '-':
		distress += 1
	if a == '+':
		x += b
print(x, distress)


(n, d) = map(int, input().split())
cry = 0
for i in range(n):
	(a, b) = input().split()
	x = int(a + b)
	if x > 0 or abs(x) <= d:
		d += x
	else:
		cry += 1
print(d, cry)


(n, x) = map(int, input().split(' '))
lines = [input() for _ in range(n)]
dis = 0
for line in lines:
	(num, sign) = line.split(' ')
	sign = int(sign)
	dis += 1 if num == '-' and x < sign else 0
	x += sign if num == '+' else 0 if x < sign else -sign
print(x, dis)


(n, x) = [int(i) for i in input().split()]
sad = 0
d = x
sad = 0
for g in range(n):
	l = input().split()
	if '+' in l[0]:
		d += int(l[1])
	elif '-' in l[0]:
		if d - int(l[1]) >= 0:
			d -= int(l[1])
		else:
			sad += 1
print(d, sad)


def free_icecream():
	distress = 0
	icecream = input().split()
	for i in range(int(icecream[0])):
		new_kid = input().split()
		if new_kid[0] == '-':
			if int(new_kid[1]) > int(icecream[1]):
				distress += 1
			else:
				icecream[1] = int(icecream[1]) - int(new_kid[1])
		else:
			icecream[1] = int(icecream[1]) + int(new_kid[1])
	print(icecream[1], distress)
free_icecream()


(v, mm, n) = (0, 0, 0)
l = []
x = input().split()
for i in range(2):
	l.append(int(x[i]))
e = l[0]
f = l[1]
mylist = []
my = []
yy = []
for m in range(e):
	x = input().split()
	if x[0] == '-':
		if int(x[1]) <= f:
			f -= int(x[1])
		else:
			n += 1
	else:
		f += int(x[1])
print(f, n)


(row, stock) = [int(x) for x in input().split()]
kid = 0
for y in range(row):
	queue = input().split()
	num = int(queue[1])
	if queue[0] == '+':
		stock += num
	elif stock >= num:
		stock -= num
	else:
		kid += 1
print(stock, kid)


l = [int(x) for x in input().split()]
n = l[0]
m = l[1]
count = 0
for i in range(n):
	s = input().split()
	s1 = s[0]
	s = int(s[1])
	if s1 == '-':
		s = -1 * s
	if s > 0:
		m += s
	else:
		s = abs(s)
		if s > m:
			count += 1
		else:
			m -= s
print(m, count)


kidscounter = 0
(x, y) = map(int, input().split())
for i in range(x):
	s = input().split()
	A = s[0]
	B = int(s[1])
	if A == '+':
		y += B
	elif y >= B:
		y -= B
	else:
		kidscounter += 1
print(y, kidscounter)


(queue, icecreams) = map(int, input().split())
distressed = 0
for _ in range(queue):
	(offer, icecream) = input().split()
	icecream = int(icecream)
	if offer == '+':
		icecreams += icecream
	elif icecreams >= icecream:
		icecreams -= icecream
	else:
		distressed += 1
print(icecreams, distressed)


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
(nb_people, have_icecream) = read_ints()
distress = 0
for i in range(nb_people):
	(ops, amt) = read_strs()
	amt = int(amt)
	if ops == '+':
		have_icecream += amt
	elif have_icecream >= amt:
		have_icecream -= amt
	else:
		distress += 1
print(have_icecream, distress)


(n, x) = [int(x) for x in input().split()]
count = 0
for i in range(n):
	(c, d) = [str(x) for x in input().split()]
	d = int(d)
	if c == '-':
		x = x - d
	if c == '+':
		x = x + d
	if x < 0:
		count += 1
		x += d
print(x, count)


(n, x) = list(map(int, input().split()))
ans = 0
for i in range(n):
	t = input().split()
	if t[0] == '+':
		x += int(t[1])
	elif int(t[1]) <= x:
		x -= int(t[1])
	else:
		ans += 1
print(x, ans)
exit(0)


(T, N) = list(map(int, input().split()))
D = 0
for _ in range(T):
	(k, n) = input().split()
	n = int(n)
	if k == '+':
		N += n
	elif N >= n:
		N -= n
	else:
		D += 1
print(N, D)


(n, x) = list(map(int, input().split()))
s = 0
for i in range(n):
	a = list(map(str, input().split()))
	q = int(a[1])
	if a[0] == '-' and x >= q:
		x = x - q
	elif a[0] == '-':
		s = s + 1
	else:
		x = x + q
print(x, s)


(n, x) = map(int, input().split())
r = 0
for _ in range(n):
	(s, m) = input().split()
	if s == '+':
		x += int(m)
	elif int(m) <= x:
		x -= int(m)
	else:
		r += 1
print(x, r)


(n, x) = map(int, input().split())
l = []
l.append(x)
count = 0
for i in range(n):
	(a, b) = map(str, input().split())
	b = int(b)
	if a == '+':
		l.append(b)
	elif sum(l) >= b:
		l.append(-b)
	else:
		count += 1
print(sum(l), count)


def ice_cream(queries, x):
	current_amount = x
	distress_kids = 0
	for query in queries:
		if query[0] == '+':
			current_amount += query[1]
		elif current_amount >= query[1]:
			current_amount -= query[1]
		else:
			distress_kids += 1
	print(str(current_amount) + ' ' + str(distress_kids))
(n, x) = map(int, input().split())
queries = []
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	queries.append([a, b])
ice_cream(queries, x)


(n, m) = map(int, input().split())
count = 0
for i in range(n):
	s = input()
	if s.find('+') != -1:
		m += int(s[1:])
	elif m >= int(s[1:]):
		m -= int(s[1:])
	else:
		count += 1
print(m, count)


(n, x) = map(int, input().split())
sad = 0
for i in range(n):
	(z, m) = input().split()
	if z == '+':
		x += int(m)
	elif int(m) > x:
		sad += 1
	else:
		x -= int(m)
print(x, sad)


nx = input().split()
n = int(nx[0])
x = int(nx[1])
kid = 0
for i in range(n):
	dd = input().split()
	mark = dd[0]
	d = int(dd[1])
	if mark == '+':
		x += d
	elif mark == '-' and d > x:
		kid += 1
	else:
		x -= d
print(x, kid)


(a, b) = map(int, input().split())
t = 0
for i in range(a):
	(typ, num) = input().split()
	num = int(num)
	if typ == '-':
		if b < num:
			t += 1
		else:
			b -= num
	else:
		b += num
print(b, t)


(n, x) = map(int, input().split())
pres = x
dis = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		pres += b
	elif pres < b:
		dis += 1
	else:
		pres -= b
print(pres, dis)


(x, d) = map(int, input().split())
c = 0
for i in range(x):
	(sg, di) = map(str, input().split())
	di = int(di)
	if sg == '+':
		d += di
	if sg == '-':
		if d < di:
			c += 1
		else:
			d -= di
print(d, c)


(n, x) = map(int, input().split())
distressed = 0
for _ in range(n):
	(op, d) = input().split()
	d = int(d)
	if op == '-' and x < d:
		distressed += 1
	elif op == '+':
		x += d
	else:
		x = max(0, x - d)
print(x, distressed, sep=' ')


inp = list(map(int, input().rstrip().split()))
packs = inp[1]
kids = 0
for i in range(0, inp[0]):
	q = list(input().rstrip().split())
	sign = q[0]
	icecream = int(q[1])
	if sign == '+':
		packs += icecream
	elif packs >= icecream:
		packs -= icecream
	else:
		kids += 1
print(packs, kids)


[num_people, current_stock] = [int(i) for i in input().split()]
lst = [input().split() for i in range(num_people)]
distressed_cnt = 0
for i in lst:
	if i[0] == '+':
		current_stock += int(i[1])
	elif current_stock >= int(i[1]):
		current_stock -= int(i[1])
	else:
		distressed_cnt += 1
print(current_stock, distressed_cnt)


(n, storage) = map(int, input().split())
sad = 0
for i in range(n):
	(types, deliver) = input().split()
	deliver = int(deliver)
	if types == '+':
		storage += int(deliver)
	if types == '-':
		if deliver <= storage:
			storage -= deliver
		else:
			sad += 1
print(storage, sad)


(n, m) = map(int, input().split())
sad = 0
for i in range(n):
	(sign, k) = input().split()
	k = int(k)
	if sign == '+':
		m += k
	elif sign == '-' and m < k:
		sad += 1
	else:
		m -= k
print(m, sad)


nx = list(map(int, input().split()))
sad_children_counter = 0
icecreams = nx[1]
for i in range(nx[0]):
	d = list(map(str, input().split()))
	if d[0] == '+':
		icecreams += int(d[1])
	elif icecreams >= int(d[1]):
		icecreams -= int(d[1])
	else:
		sad_children_counter += 1
print(icecreams, sad_children_counter)


string = str(input())
array = string.split()
n = int(array[0])
x = int(array[1])
arr = []
for i in range(n):
	string2 = str(input())
	tmp = string2.split()
	arr.append(tmp)
child = 0
for i in range(len(arr)):
	if arr[i][0] == '+':
		x += int(arr[i][1])
	if arr[i][0] == '-':
		if x < int(arr[i][1]):
			child += 1
		else:
			x = x - int(arr[i][1])
print(x, end='')
print(' ', end='')
print(child)


def solve():
	(N, X) = map(int, input().split())
	dis = 0
	for i in range(N):
		(s, d) = input().split()
		d = int(d)
		if s == '+':
			X += d
		elif X < d:
			dis += 1
		else:
			X -= d
	print(X, dis)
solve()


(n, sum_) = map(int, input().split())
cnt = 0
for i in range(n):
	(op, d) = input().split()
	d = int(d)
	sum_ += d if op == '+' else -d
	if sum_ < 0:
		cnt += 1
		sum_ += d
print(f'{sum_} {cnt}')


k = 0
(t, i) = map(int, input().split())
for _ in range(t):
	(s, c) = input().split()
	c = int(c)
	if s == '+':
		i += c
	elif c <= i:
		i -= c
	else:
		k += 1
print(i, k)


(n, k) = [int(i) for i in input().split()]
count = 0
for i in range(0, n):
	(s, val) = input().split()
	if s == '+':
		k += int(val)
	elif k < int(val):
		count += 1
	else:
		k -= int(val)
print(k, count)


(n, x) = map(int, input().split())
a = [input().split() for i in range(n)]
counter1 = x
counter2 = 0
for i in a:
	if i[0] == '+':
		counter1 += int(i[1])
	elif counter1 >= int(i[1]):
		counter1 -= int(i[1])
	else:
		counter2 += 1
print(counter1, counter2)


num = [int(n) for n in input().split()]
count = 0
for i in range(num[0]):
	p = input()
	p1 = p[2:len(p)]
	if p[0] == '+':
		num[1] = num[1] + int(p1)
	elif num[1] >= int(p1):
		num[1] = num[1] - int(p1)
	else:
		count = count + 1
print(num[1], count)


(x, y) = map(int, input().split(' '))
carry = y
distress = 0
for i in range(x):
	(c, d) = input().split(' ')
	d = int(d)
	if c == '+':
		carry += d
	elif c == '-':
		if carry - d >= 0:
			carry -= d
		else:
			distress += 1
print('{} {}'.format(carry, distress))


(n, s) = list(map(int, input().split()))
g = 0
x = s
for i in range(n):
	(m, d) = list(input().split())
	if m == '+':
		s += int(d)
		x += int(d)
	if m == '-':
		x -= int(d)
	if m == '-' and int(d) <= s:
		s -= int(d)
	if x < 0:
		g += 1
	x = s
print(s, g)


(n, packs) = list(map(int, input().split()))
distressed_child = 0
for it in range(n):
	(inp, new_packs) = input().split()
	new_packs = int(new_packs)
	if inp == '+':
		packs += new_packs
	else:
		if new_packs > packs:
			distressed_child += 1
			continue
		packs -= new_packs
print(packs, distressed_child)


def solve(a, b):
	t = 0
	while a:
		(t1, t2) = input().split()
		if t1 == '+':
			b += int(t2)
		elif t1 == '-':
			if b >= int(t2):
				b -= int(t2)
			else:
				t += 1
		a -= 1
	print(b, t)
(a, b) = input().split()
solve(int(a), int(b))


(n, x) = map(int, input().split(' '))
n = int(n)
x = int(x)
icVal = x
dCount = 0
while n > 0:
	(a, b) = input().split(' ')
	b = int(b)
	if a == '-':
		b = b * -1
	if icVal + b >= 0:
		icVal = icVal + b
	else:
		dCount = dCount + 1
	n = n - 1
print(str(icVal) + ' ' + str(dCount))


def main():
	(n, x) = map(int, input().split())
	sad_kids_num = 0
	for _ in range(n):
		(stat, y) = input().split()
		if stat == '+':
			x += int(y)
		else:
			y = int(y)
			if x >= y:
				x -= y
			else:
				sad_kids_num += 1
	print(x, sad_kids_num)
main()


nx = input().split()
n = int(nx[0])
x = int(nx[1])
count = 0
while n > 0:
	n -= 1
	s = input().split()
	if s[0] == '+':
		x += int(s[1])
	else:
		y = int(s[1])
		if y <= x:
			x -= y
		else:
			count += 1
print(x, count)


def solution(x, queue):
	packs = x
	kids_in_distress = 0
	for d in queue:
		if packs + d >= 0:
			packs += d
		else:
			kids_in_distress += 1
	return (packs, kids_in_distress)
(n, x) = map(int, input().split())
queue = []
for _ in range(n):
	queue.append(int(input().replace(' ', '')))
print(*solution(x, queue))


count1 = 0
(n, x) = [int(i) for i in input().split()]
for j in range(n):
	(a, d) = [i for i in input().split()]
	if a == '+':
		x += int(d)
	elif x - int(d) < 0:
		count1 += 1
	else:
		x = x - int(d)
print(x, count1)


(n, x) = map(int, input().split())
sum = x
counter = 0
xc = 0
p = '+'
m = '-'
for i in range(0, n):
	result = input().split()
	(s, d) = (result[0], int(result[1]))
	if s == m:
		if sum < d:
			counter += 1
		else:
			sum -= d
	elif s == p:
		sum += d
print(sum, counter)


(n, x) = list(map(int, input().split(' ')))
m = x
c = 0
for i in range(n):
	s = input()
	if s[0] == '+':
		m += int(s[2:])
	else:
		d = int(s[2:])
		if m >= d:
			m -= d
		else:
			c += 1
print(str(m) + ' ' + str(c))


(n, k) = map(int, input().split())
p = 0
for t in range(n):
	(s, c) = input().split()
	if s == '+':
		k += int(c)
	elif s == '-' and k - int(c) >= 0:
		k -= int(c)
	else:
		p += 1
print(k, p)


(n, x) = map(int, input().split())
cur_capa = x
dk = 0
for i in range(n):
	(op, quant) = map(str, input().split())
	quant = int(quant)
	if op == '+':
		cur_capa += quant
	elif cur_capa < quant:
		dk += 1
	else:
		cur_capa -= quant
print(cur_capa, dk)


(x, y) = map(int, input().split())
total = y
dissappoint = 0
for _ in range(x):
	(a, b) = map(str, input().split())
	b = int(b)
	if a == '+':
		total += b
		continue
	if a == '-' and total >= b:
		total -= b
	else:
		dissappoint += 1
print('{} {}'.format(total, dissappoint))


import math
(n, x) = list(map(int, input().split()))
sad = 0
ice = x
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		ice += b
	else:
		ice -= b
		if ice < 0:
			ice += b
			sad += 1
			x = 0
print(ice, sad)


(n, x) = map(int, input().split())
cnt = 0
for i in range(n):
	(sgn, v) = input().split()
	v = int(v)
	if sgn == '+':
		x += v
	if sgn == '-':
		if x >= v:
			x -= v
		else:
			cnt += 1
print(x, cnt)


read = lambda : map(int, input().split())
(n, x) = read()
cnt1 = x
cnt2 = 0
for i in range(n):
	s = input().split()
	d = int(s[1])
	if s[0] == '+':
		cnt1 += d
	elif cnt1 >= d:
		cnt1 -= d
	else:
		cnt2 += 1
print(cnt1, cnt2)


inp = input().split(' ')
n = int(inp[0])
total = int(inp[1])
distressted = 0
for i in range(n):
	inp = input().split(' ')
	if inp[0] == '+':
		total += int(inp[1])
	else:
		take = int(inp[1])
		if take > total:
			distressted += 1
		else:
			total -= take
print(total, distressted)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, x) = LI()
	a = [LS() for _ in range(n)]
	c = 0
	for (k, t) in a:
		t = int(t)
		if k == '-':
			if x < t:
				c += 1
			else:
				x -= t
		else:
			x += t
	return '{} {}'.format(x, c)
print(main())


(n, x) = [int(i) for i in input().split()]
c = 0
for _ in range(n):
	(op, num) = [i for i in input().split()]
	num = int(num)
	if op == '+':
		x += num
	elif x >= num:
		x -= num
	else:
		c += 1
print(x, c)


inp = input().split()
(n, x) = (int(inp[0]), int(inp[1]))
dis = 0
for i in range(n):
	q = input().split()
	if q[0] == '+':
		x += int(q[1])
	elif x >= int(q[1]):
		x -= int(q[1])
	else:
		dis += 1
print(x, dis)


(n, x) = [int(i) for i in input().split()]
S = 0
for i in range(n):
	(p, q) = [i for i in input().split()]
	if p == '+':
		x += int(q)
	elif int(q) > x:
		S += 1
	else:
		x -= int(q)
print(x, S)


(num, numberOfIcecream) = input().split()
num = int(num)
numberOfIcecream = int(numberOfIcecream)
distressedChildren = 0
i = 0
while i < num:
	(sign, iceCream) = input().split()
	iceCream = int(iceCream)
	if sign == '+':
		numberOfIcecream += iceCream
	elif iceCream > numberOfIcecream:
		distressedChildren += 1
	else:
		numberOfIcecream -= iceCream
	i += 1
print(numberOfIcecream, distressedChildren)


(n, x) = map(int, input().split())
k = 0
for _ in range(n):
	(a, t) = input().split()
	if a == '+':
		x += int(t)
	elif x < int(t):
		k += 1
	else:
		x -= int(t)
print(x, k)


def IceCream():
	(n, x) = list(map(int, input().split()))
	distressed = 0
	for i in range(n):
		(det, num) = input().split()
		if det == '+':
			x += int(num)
		elif int(num) > x:
			distressed += 1
		else:
			x -= int(num)
	print(x, distressed)
IceCream()


from sys import stdin
(n, m) = map(int, stdin.readline().strip().split())
x = 0
for i in range(n):
	(a, b) = stdin.readline().strip().split()
	b = int(b)
	if a == '+':
		m += int(b)
	elif m >= b:
		m -= b
	else:
		x += 1
print(m, x)


(n, x) = [int(x) for x in input().split()]
t = 0
while n != 0:
	(a, b) = [x for x in input().split()]
	if a == '+':
		x += int(b)
	elif x >= int(b):
		x -= int(b)
	else:
		t += 1
	n -= 1
print(x, t)


def main():
	(n, x) = map(int, input().split())
	y = 0
	for _ in range(n):
		s = input()
		d = int(s[1:])
		if s[0] == '+':
			x += d
		elif x < d:
			y += 1
		else:
			x -= d
	print(x, y)
main()


(n, x) = list(map(int, input().split(' ')))
i = 0
t = 0
while i < n:
	(a, b) = input().split()
	if a == '+':
		x = x + int(b)
	elif int(b) > x:
		t = t + 1
	else:
		x = x - int(b)
	i = i + 1
print(str(x) + ' ' + str(t))


def main():
	(n, x) = map(int, input().split())
	count = 0
	for i in range(n):
		a = list(input().split())
		d = int(a[1])
		if a[0] == '+':
			x += d
		elif d <= x:
			x -= d
		else:
			count += 1
	print(x, count)
main()


start = input('').split(' ')
moves = int(start[0])
ice_cream = int(start[1])
distress_kids = 0
for i in range(moves):
	queue = input('').split(' ')
	ice_cream_required = int(queue[1])
	if queue[0] == '+':
		ice_cream += ice_cream_required
	elif ice_cream < ice_cream_required:
		distress_kids += 1
	else:
		ice_cream -= ice_cream_required
print(f'{ice_cream} {distress_kids}')


(n, now) = tuple(map(int, input().split()))
sad = 0
for i in range(n):
	(zn, num) = tuple(input().split())
	if zn == '+':
		now += int(num)
	elif int(num) > now:
		sad += 1
	else:
		now -= int(num)
print(now, sad)


r = lambda : input().split()
(k, n) = map(int, r())
left = 0
for x in range(k):
	(s, v) = r()
	if s == '+':
		n += int(v)
	elif int(v) <= n:
		n -= int(v)
	else:
		left += 1
print(n, left)


(n, x) = map(int, input().strip().split()[:2])
un = 0
for x1 in range(n):
	(l, m) = input().strip().split()[:2]
	m = int(m)
	if l == '-':
		if x - m < 0:
			un += 1
		else:
			x = x - m
	else:
		x += m
print(x, un)


class test3:

	def demo(self, init, input_list):
		sum = int(init)
		kids = 0
		for item in input_list:
			if item[0] == '+':
				sum += int(item[1])
			elif int(item[1]) <= sum:
				sum -= int(item[1])
			else:
				kids += 1
		print(sum, kids)

def test():
	test_lists = [[7, [['+', '5'], ['-', '10'], ['-', '20'], ['+', '40'], ['-', '20']]], [17, [['-', '16'], ['-', '2'], ['-', '98'], ['+', '100'], ['-', '98']]]]
	for line in test_lists:
		print(line)
		test3().demo(line[0], line[1])

def main():
	input_list1 = input().strip().split()
	num = int(input_list1[0])
	init = int(input_list1[1])
	input_list = []
	for i in range(num):
		input_list.append(input().strip().split())
	test3().demo(init, input_list)
main()


(n, x) = input().split()
s = []
r = []
q = int(x)
c = 0
for i in range(int(n)):
	(a, b) = input().split()
	s.append(a)
	r.append(b)
for i in range(len(s)):
	if s[i] == '+':
		q += int(r[i])
	elif s[i] == '-':
		if int(r[i]) <= q:
			q -= int(r[i])
		else:
			c += 1
print(q, c)


(n, x) = map(int, input().split())
p = x
di = 0
for i in range(n):
	(s, d) = map(str, input().split())
	d = int(d)
	if s == '+':
		p = p + d
	if s == '-':
		if d > p:
			di = di + 1
		else:
			p = p - d
print(p, di)


ans = 0
(nn, x) = map(int, input().split())
for i in range(nn):
	(c, y) = input().split()
	y = int(y)
	if c == '+':
		x += y
	elif x >= y:
		x -= y
	else:
		ans += 1
print(x, ans)


import os
import sys
from io import BytesIO, IOBase

def solve():
	(n, x) = map(int, input().split())
	ini = x
	dis = 0
	for i in range(n):
		q = input()
		if q[0] == '+':
			ini = ini + int(q[2:])
		elif q[0] == '-':
			if ini >= int(q[2:]):
				ini = ini - int(q[2:])
			else:
				dis = dis + 1
	print(ini, dis)

def main():
	solve()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(x, y) = map(int, input().split())
c = 0
while x > 0:
	(a, b) = input().split()
	b = int(b)
	if a == '-' and b <= y:
		y -= b
	elif a == '+':
		y += b
	elif a == '-' and b > y:
		c += 1
	x -= 1
print(y, c)


(n, k) = map(int, input().split())
d = 0
for _ in range(n):
	s = input()
	(sign, v) = map(str, s.split())
	v = int(v)
	if sign == '+':
		k = k + v
	elif v > k:
		d += 1
	else:
		k = k - v
print(k, d)


(n, x) = map(int, input().split())
qtd = 0
for i in range(n):
	(sinal, num) = input().split()
	if sinal == '-':
		x -= int(num)
		if x < 0:
			x += int(num)
			qtd += 1
	else:
		x += int(num)
print(x, qtd, sep=' ')


(n, x) = map(int, input().split())
(distressed, total) = (0, x)
for i in range(n):
	(op, tot) = input().split()
	tot = int(tot)
	if op == '+':
		total += tot
	elif total - tot >= 0:
		total -= tot
	else:
		distressed += 1
print(total, distressed)


(n, x) = map(int, input().split())
l = [0] * n
c = 0
for i in range(n):
	(d, t) = input().split()
	t = int(t)
	if d == '+':
		x = x + t
	elif d == '-':
		x = x - t
		if x < 0:
			c += 1
			x = x + t
print(x, c)


packs_number = [int(x) for x in input().split(' ')]
people = packs_number[0]
packs = packs_number[1]
list_1 = []
distressed = 0
left_packs = 0
for times in range(people):
	standing = input()
	list_1.append(standing)
for item in list_1:
	if '+' in item:
		item_1 = item.replace('+', ' ')
		packs += int(item_1)
	elif '-' in item:
		item_2 = item.replace('-', ' ')
		if int(item_2) > packs:
			distressed += 1
		else:
			packs -= int(item_2)
left_packs += packs
print(left_packs, distressed)


(n, x) = [int(x) for x in input().split()]
packs = x
leave = 0
for i in range(0, n):
	inputs = input().split()
	if inputs[0] == '-':
		a = int(inputs[1]) * -1
	else:
		a = int(inputs[1])
	if packs + a < 0:
		leave += 1
	else:
		packs += a
print(packs, leave)


(n, d) = [int(i) for i in input().split()]
(icecream, sad) = (d, 0)
for i in range(n):
	inp = input().split()
	if inp[0] == '+':
		icecream += int(inp[1])
	elif icecream < int(inp[1]):
		sad += 1
	else:
		icecream -= int(inp[1])
print(icecream, sad)


(a, b) = list(map(int, input().split()))
kid = 0
for i in range(a):
	(x, y) = list(input().split())
	if x == '+':
		b += int(y)
	elif x == '-':
		if b >= int(y):
			b -= int(y)
		elif b < int(y):
			kid += 1
print(b, kid)


import sys
from math import sqrt, floor, factorial
from collections import deque
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	(n, x) = read()
	dis = 0
	for _ in range(n):
		(s, v) = inp().strip().split()
		v = int(v)
		if '+' == s:
			x += v
		elif x < v:
			dis += 1
		else:
			x -= v
	print(x, dis)
solve()


(n, x) = input().split()
(n, x) = (int(n), int(x))
k = 0
for i in range(n):
	b = input().split()
	if b[0] == '+':
		x += int(b[1])
	elif x >= int(b[1]):
		x -= int(b[1])
	else:
		k += 1
print(x, k)


(n, m) = map(int, input().split())
sads = 0
for _ in range(n):
	(sign, num) = input().split()
	if sign == '+':
		m += int(num)
	elif m >= int(num):
		m -= int(num)
	else:
		sads += 1
print(m, sads)


def detector(n, x):
	distress_kid = 0
	for i in range(0, n):
		y = input()
		if '+' in y:
			x = x + int(y[2:])
		elif int(y[2:]) > x:
			distress_kid += 1
		else:
			x = x - int(y[2:])
	print(x, distress_kid)
(n, x) = map(int, input().split())
detector(n, x)


(n, m) = map(int, input().split())
cnt = 0
for i in range(n):
	(g, h) = input().split()
	h = int(h)
	if g in '+':
		m += h
	elif h <= m:
		m -= h
	else:
		cnt += 1
print(m, cnt)


(x, ice) = map(int, input().split())
count = 0
for i in range(0, x):
	c = input().split()
	if c[0] == '-':
		if ice >= int(c[1]):
			ice -= int(c[1])
		else:
			count += 1
	else:
		ice += int(c[1])
print(ice, count)


(n, iceCreamPacks) = map(int, input().split())
queue = []
for i in range(n):
	queue.append(input().replace(' ', ''))
queue = [int(x) for x in queue]
distressed = 0
for person in queue:
	if person > 0:
		iceCreamPacks += person
	elif iceCreamPacks >= abs(person):
		iceCreamPacks = iceCreamPacks + person
	else:
		distressed += 1
print(iceCreamPacks, distressed)


(customers, capital) = map(int, input().split())
sad_kids = 0
for i in range(customers):
	(desire, quantity) = input().split()
	if desire == '+':
		capital += int(quantity)
	elif capital >= int(quantity):
		capital -= int(quantity)
	else:
		sad_kids += 1
print(capital, sad_kids)


s = input().split()
n = int(s[0])
x = int(s[1])
y = 0
for i in range(n):
	s = input().split()
	if s[0] == '+':
		x += int(s[1])
	elif int(s[1]) <= x:
		x -= int(s[1])
	else:
		y += 1
print(x, y)


s = [int(n) for n in input().split()]
a = s[0]
x = s[1]
l = 0
j = 0
for n in range(a):
	d = [b for b in input().split()]
	k = int(d[1])
	if d[0] == '-':
		k = -k
	if x + k < 0:
		l += 1
		x = x
	else:
		x += k
print(x, l)


(n, x) = input().split(' ')
(n, x) = (int(n), int(x))
distressed_kid = 0
for i in range(n):
	val = input().split(' ')
	if val[0] == '+':
		x += int(val[1])
	elif int(val[1]) > x:
		distressed_kid += 1
	else:
		x -= int(val[1])
print(x, distressed_kid)


(a, b) = map(int, input().split())
x = b
d = 0
for i in range(a):
	(p, q) = input().split()
	if p == '+':
		x += int(q)
	elif p == '-':
		if x - int(q) >= 0:
			x -= int(q)
		else:
			d += 1
print(x, d)


n = list(map(int, input().split()))
m = n
number = m[0]
packs = m[1]
c = []
dis = 0
for i in range(number):
	v = list(map(str, input().split()))
	c.append(v)
for i in c:
	if i[0] == '+':
		packs = packs + int(i[1])
	elif packs >= int(i[1]):
		packs = packs - int(i[1])
	else:
		dis = dis + 1
print(packs, dis)


import math

def main():
	(n, x) = map(int, input().split())
	d = 0
	for _ in range(n):
		(op, amt) = input().split()
		amt = int(amt)
		if op == '+':
			x += amt
		elif op == '-':
			if amt > x:
				d += 1
			else:
				x -= amt
	print(x, d)
main()


data = input().split(' ')
que_no = int(data[0])
packages = int(data[1])
distressed = 0
for i in range(0, que_no):
	que_member = input().split(' ')
	if que_member[0] == '-':
		if packages >= int(que_member[1]):
			packages -= int(que_member[1])
		else:
			distressed += 1
	else:
		packages += int(que_member[1])
print('{} {}'.format(packages, distressed))


(n, x) = map(int, input().split())
queue = []
while n > 0:
	inp = input()
	queue.append(inp)
	n -= 1
ice_count = x
distress = 0
i = 0
while i < len(queue):
	z = queue[i]
	if z[0] == '+':
		ice_count += int(z[1:])
	else:
		ice_count -= int(z[1:])
	if ice_count < 0:
		ice_count += int(z[1:])
		distress += 1
	i += 1
print(ice_count, distress)


l = list(map(int, input().strip().split()))
(n, m) = (l[0], l[1])
res = m
ds = 0
while n != 0:
	lx = list(map(str, input().strip().split()))
	s = str(lx[0])
	x = int(lx[1])
	if s == '+':
		res += x
	elif x > res:
		ds += 1
	else:
		res -= x
	n -= 1
print(res, ds)


a = input().split()
n = int(a[0])
k = int(a[1])
given = 0
distressed = 0
for i in range(n):
	x = int(''.join(input().split()))
	if x < 0 and k + x >= 0:
		k += x
		given -= x
	elif x < 0 and k + x < 0:
		distressed += 1
	else:
		k += x
print(k, distressed)


def dechif(l, t):
	if l[0] == '+':
		return t + int(l[1])
	elif l[0] == '-':
		return t - int(l[1])
a = 0
l1 = input().split(' ')
n = int(l1[0])
x = int(l1[1])
for i in range(n):
	req = input().split(' ')
	val = dechif(req, x)
	if val >= 0:
		x = dechif(req, x)
	else:
		a += 1
print(x, a)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
q = []
sm = 0
lo = b
for i in range(a):
	q.append(input())
for i in range(len(q)):
	if '+' in q[i]:
		q[i] = int(q[i][1:])
		lo = lo + q[i]
	elif '-' in q[i]:
		if int(q[i][1:]) > lo:
			sm += 1
		else:
			lo = lo - int(q[i][1:])
print(lo, sm)


queue = []
xd = input()
for i in range(int(xd.split(' ')[0])):
	queue.append(input())
total = int(xd.split(' ')[1])
distressed = 0
for i in queue:
	if i[0] == '+':
		total += int(i[2:])
	elif i[0] == '-':
		if total >= int(i[2:]):
			total -= int(i[2:])
		else:
			distressed += 1
	else:
		raise BaseException('not - not +')
print(total, distressed)


(n, m) = map(int, input().split())
ic = m
kid = 0
mang = [[cot for cot in input().split()] for dong in range(n)]
for i in range(n):
	if mang[i][0] == '+':
		ic += int(mang[i][1])
	elif ic < int(mang[i][1]):
		kid += 1
	else:
		ic = ic - int(mang[i][1])
print(ic, kid)


import sys

def main():
	(n, x) = map(int, sys.stdin.readline().split())
	sad = 0
	for i in range(0, n):
		(sign, d) = sys.stdin.readline().split()
		d = int(d)
		if sign == '+':
			x += d
		elif x >= d:
			x -= d
		else:
			sad += 1
	sys.stdout.write(str(x) + ' ' + str(sad))
main()


import math

def s():
	(n, x) = [int(x) for x in input().split(' ')]
	distressed = 0
	for i in range(n):
		stri = input()
		if stri[0] == '+':
			x += int(stri[2:])
		elif int(stri[2:]) > x:
			distressed += 1
		else:
			x -= int(stri[2:])
	print(x, distressed)
s()


(n, h) = map(int, input().split())
kids = 0
for i in range(n):
	p = int(''.join(map(str, input().split())))
	if h + p < 0:
		kids += 1
	else:
		h = h + p
print(h, kids)


(n, m) = map(int, input().split())
dis = 0
for f in range(n):
	s = input()
	if eval(str(m) + s) >= 0:
		m = eval(str(m) + s)
	else:
		dis += 1
print(m, dis)


(number, start) = map(int, input().split())
count = 0
for i in range(number):
	(sign, value) = input().split()
	value = int(value)
	if sign == '+':
		start += value
	elif start < value:
		count += 1
	else:
		start -= value
print(start, count, sep=' ')


(n, d) = input().split()
(n, d) = (int(n), int(d))
dist = 0
total = d
for i in range(n):
	(ch, amount) = input().split()
	amount = int(amount)
	if ch == '+':
		total += amount
	elif ch == '-':
		if total < amount:
			dist += 1
		else:
			total -= amount
print(total, dist)


from sys import stdin

def solution():
	(n, x) = [int(z) for z in stdin.readline().strip().split()]
	ls = list()
	for i in range(0, n):
		(v, z) = [x for x in stdin.readline().strip().split()]
		ls.append((v, int(z)))
	d = 0
	for c in ls:
		if c[0] == '+':
			x += c[1]
		else:
			x -= c[1]
		if x < 0:
			x += c[1]
			d += 1
	return (x, d)
(x, d) = solution()
print('%d %d' % (x, d))


(s, t) = input().split()
s = int(s)
t = int(t)
c = 0
l = []
for i in range(0, s):
	(sg, p) = input().split()
	p = int(p)
	l.append([sg, p])
for x in l:
	if x[0] == '+':
		t = t + x[1]
	elif t > x[1] or t == x[1]:
		t = t - x[1]
	else:
		c += 1
print(t, c)


import sys
input = sys.stdin.readline
f = lambda : list(map(int, input().split()))
(n, x) = f()
cnt = 0
for i in range(n):
	(c, d) = input().split()
	if c == '+':
		x += int(d)
	elif x < int(d):
		cnt += 1
	else:
		x -= int(d)
print(x, cnt)


(a, b) = map(int, input().split())
z = 0
for i in range(a):
	s = input()
	if s[0] == '+':
		b = b + int(s[2:])
	elif b >= int(s[2:]):
		b = b - int(s[2:])
	else:
		z += 1
print(b, z)


(n, x) = map(int, input().split())
kids = 0
for i in range(n):
	(operator, amount) = input().split()
	operator = str(operator)
	amount = int(amount)
	if operator == '+':
		x += amount
	elif amount > x:
		kids += 1
	else:
		x -= amount
print(x, kids)


(n, m) = map(int, input().split())
count = 0
result = m
for _ in range(n):
	(p, q) = map(str, input().split())
	if p == '+':
		result = result + int(q)
	elif int(q) <= result:
		result = result - int(q)
	else:
		count = count + 1
print(result, count)


(n, x) = map(int, input().split())
d = 0
for _ in range(n):
	(ex, a) = input().split()
	if ex == '+':
		x += int(a)
	elif x < int(a):
		d += 1
	else:
		x -= int(a)
print(x, d)


s = input().split()
n = int(s[0])
x = int(s[1])
result = 0
for i in range(n):
	g = input().split()
	if g[0] == '+':
		x += int(g[1])
	if g[0] == '-' and x >= int(g[1]):
		x -= int(g[1])
	elif g[0] == '-' and x < int(g[1]):
		result += 1
print(x, result)


def p1():
	(n, m) = [float(i) for i in input().split('e')]
	if n * 10 ** m == int(n * 10 ** m):
		print(int(n * 10 ** m))
	else:
		print(n * 10 ** m)

def p2():
	n = int(input())
	l = [int(i) for i in input().split()]
	ans = 'YES'
	if n == 1:
		if l.count(0) == 1:
			ans = 'NO'
	elif l.count(0) != 1:
		ans = 'NO'
	print(ans)

def p3():
	(n, m) = [int(i) for i in input().split()]
	k = 0
	m2 = 0
	for j in range(m):
		a = input()
		if a.count('1') == len(a):
			m2 = max(m2, k)
			k = 0
		else:
			k = k + 1
	m2 = max(m2, k)
	print(m2)

def p4():
	(n, m) = [int(i) for i in input().split()]
	t = 0
	l = m
	for i in range(n):
		a = input().split()
		b = int(a[1])
		a = a[0]
		if a == '+':
			l = l + b
		elif l >= b:
			l = l - b
		else:
			t = t + 1
	print(l, t)

def p5():
	(n, m) = [int(i) for i in input().split()]
	l = []
	v = []
	g = []
	for i in range(n):
		s = input()
		l.append(s)
		v.append(s.count('*'))
	for i in range(m):
		t = 0
		for j in range(n):
			if l[j][i] == '*':
				t = t + 1
		g.append(t)
	ans = 'NO'
	c = sum(v)
	for i in range(n):
		for j in range(m):
			t = v[i] + g[j]
			if l[i][j] == '*':
				t = t - 1
			if t == c:
				ans = 'YES'
				(x, y) = (i + 1, j + 1)
				break
		if ans == 'YES':
			break
	print(ans)
	if ans == 'YES':
		print(x, y)
p4()


(n, x) = map(int, input().split())
b = 0
for i in range(n):
	a = list(map(str, input().split()))
	if a[0] is '+':
		x = x + int(a[1])
	elif x >= int(a[1]):
		x = x - int(a[1])
	else:
		b = b + 1
print(x, b)


(m, n) = map(int, input().split())
c = 0
for i in range(m):
	(sign, n2) = input().split()
	if sign == '+':
		n += int(n2)
	if sign == '-':
		if int(n2) > n:
			c += 1
		else:
			n -= int(n2)
print(n, c)


(m, n) = map(int, input().split())
cnt = 0
for i in range(m):
	(ch, t) = input().split()
	t = int(t)
	if ch == '+':
		n += t
	if ch == '-':
		if t > n:
			cnt += 1
		else:
			n -= t
print(n, cnt)


def ice_cream(x, arr):
	ice = x
	g = 0
	for i in arr:
		y = i.split()
		val = int(y[1])
		if y[0] == '+':
			ice += val
		elif val > ice:
			g += 1
		else:
			ice -= val
	print(ice, g)
x = list(map(int, input().rstrip().split()))
n = x[0]
p = x[1]
ans = []
for i in range(n):
	val = input()
	ans.append(val)
ice_cream(p, ans)


(people, packs) = input().split()
people = int(people)
packs = int(packs)
distress = 0
for i in range(people):
	(action, pack) = input().split()
	if action == '+':
		packs += int(pack)
	elif action == '-' and packs >= int(pack):
		packs -= int(pack)
	elif action == '-' and packs < int(pack):
		distress += 1
print(f'{packs} {distress}', end='')