def srrent(x, y):
	cnt = 0
	sm = 0
	s = y
	while(s <= x):
		cnt += 1
		sm += s
		s += y
	if (s > x and s != x + y):
		cnt += 1
		sm += x
	return sm / cnt

inf = open("castle.in", "r")
outf = open("castle.out", "w")

n, s= map(int, inf.readline().split())
arr = []
for i in range(n):
	x, y = map(int, inf.readline().split())
	arr.append([x, y])
allzero = False
while (s > 0 and not allzero):
	allzero = True
	minind = -1
	for i in range(n):
		if (arr[i][0] != 0):
			minind = i
			allzero = False
			break
	if (allzero):
		break
	for i in range(n):
		if (arr[i][0] > 0 and min(arr[i]) > min(arr[minind])):
			minind = i
	arr[minind][0] -= min(arr[minind]);
	s -= 1
print(sum([i[0] for i in arr]), file = outf)
inf.close()
outf.close()