fin = open('castle.in', 'r')
fout = open('castle.out', 'w')
input = fin.readline

read = lambda: map(int, input().split())
n, s = read()
A = [0] * n
for i in range(n):
    A[i] = tuple(read())
A.sort(key = lambda x: -x[1])

cur = s
ans = sum(a for a, k in A)
for i in range(n):
    a, k = A[i][0], A[i][1]
    x = min(cur, a // k)
    ans -= x * k
    cur -= x
    rem = a % k
    if i < n - 1 and rem >= A[i + 1][1] and cur > 0:
        x += 1
        cur -= 1
        ans -= rem
    elif i == n - 1 and cur > 0:
        x += 1
        cur -= 1
        ans -= rem

print(ans, file = fout)

fin.close()
fout.close()