inf = open("castle.in", "r")
outf = open("castle.out", "w")
n, s = map(int, inf.readline().split())
pref = []
ans = 0
for i in range(n):
    a, b = map(int, inf.readline().split())
    pref.append([b, a // b])
    if a % b != 0:
        pref.append([a % b, 1])
    ans += a
pref.sort()
crnt = s
i = -1
while crnt > 0 and i >= len(pref) * (-1):
    ans -= pref[i][0] * pref[i][1]
    crnt -= pref[i][1]
    i -= 1
ans = max(0, ans)
outf.write(str(ans))
outf.close()