N = 10 ** 5 + 10
n, m = map(int, input().split())
a, b = [0] * N, [0] * N
for i in range(n):
a[i], b[i] = map(int, input().split())
def check(x):
res = 0
for i in range(n):
if a[i] >= x:
res += (a[i] - x) // b[i] + 1
return res >= m
l, r = 0, 10 ** 6
while l < r:
mid = l + r + 1 >> 1
if check(mid):
l = mid
else:
r = mid - 1
x = l
res = 0
cnt = 0
for i in range(n):
if a[i] >= x:
n = (a[i] - x) // b[i] + 1
cnt += n
res += (2 * a[i] - b[i] * (n - 1)) * n // 2
print(res - (cnt - m) * x)