# Arup Guha
# 2/17/2026
# Solution to Kattis Problem Financial Planning
# Used to illustrate integer binary search.
# https://open.kattis.com/problems/financialplanning

# Returns max profit for days number of days.
def f(items, days):

    res = 0
    for item in items:

        # Here we skip negative investments.
        if item[0]*days > item[1]:
            res += item[0]*days-item[1]

    return res

# Get basic input.
toks = input().split()
n = int(toks[0])
money = int(toks[1])

# List of investments.
items = []
for i in range(n):
    items.append([int(x) for x in input().split()])

# Based on our analysis of the profit.
low = 1
high = (money+items[0][1]+items[0][0]-1)//(items[0][0])

# Integer binary search is like this.
while low < high:

    # Go half way and evaluate.
    mid = (low+high)//2;
    mine = f(items, mid)

    # Answer is no more than mid.
    if mine >= money:
        high = mid

    # Answer must be mid+1 or higher.
    else:
        low = mid+1

# Ta da!
print(low)

                       
