input_ = input().split(' ')

max_katana = int(input_[0])
mamono = int(input_[1])


def get_katana_list():
    katana_list = []
    for count in range(0, max_katana):
        input_ = input().split(' ')
        huru_damege = int(input_[0])
        nageru_damege = int(input_[1])
    
        katana_list.append({
            'huru' : huru_damege,
            'nageru' : nageru_damege
        })

    return katana_list

def get_damege_list(katana_list):
    damage_list = []
    count = 0
    for katana in katana_list:
        count += 1
        damage_list.append([katana['huru'], count , katana])
        damage_list.append([katana['nageru'], count , katana])

    damage_list.sort()
    damage_list.reverse()
    return damage_list

def try_attack(mamono, katana_list, damage_list):
    count = 0
    while mamono > 0:
        if len(damage_list) == 2 and mamono - damage_list[0][2]['nageru'] <= 0:
            mamono -= damage_list[0][2]['nageru']
            count += 1
        elif len(damage_list) == 2:
            mamono -= damage_list[0][2]['huru']
            count += 1
        else:
            count += 1
            mamono -= damage_list[0][0]

            if damage_list[0][2]['huru'] != damage_list[0][0] and damage_list[0][2]['nageru'] == damage_list[0][0]:
                count__ = 0
                for damage in damage_list:
                    if damage[2] == damage_list[0][2]:
                        damage_list.pop(count__)
                    else:
                        pass
                    count__ += 0
    return count

katana_list = get_katana_list()
damage_list = get_damege_list(katana_list)

print(try_attack(mamono, katana_list, damage_list))