#!/usr/bin/python3

from sys import float_info
from heapq import *

n, k = map(int, input().split())
qf = []
total_food = 0

for i in range(n):
    q, f = map(int, input().split())
    total_food += q
    qf.append((q, f-1))

# relative error of 1e-9
ulp = 10**7 * float_info.epsilon

def binary_search(f, low, high):

    while high - low > max(1e-16, max(abs(low), abs(high)) * ulp):
        m = (low + high)/2
        if f(m):
            low = m
        else:
            high = m
    return (low + high)/2

def check_feasibility(perday):
    food = []
    for i, (q, f) in enumerate(qf):
        # (1) scavenge
        heappush(food, (f, q))

        # (2) feed
        need = k * perday
        while need > 0 and len(food) > 0:
            exp, amount = heappop(food)
            if amount >= need:
                amount -= need
                need = 0
                heappush(food, (exp, amount))
            else:
                need -= amount
                amount = 0
        if need > 0:
            return False

        # (3) expire
        while len(food) > 0 and food[0][0] <= i:
            heappop(food)

    return True

r = binary_search(check_feasibility, 0, total_food/k/n)
print (-1 if abs(r) < 1e-10 else r)
