using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

struct Place
{
    public long a, k;
    public int g;
    public Place(long[] b)
    {
        a = b[0];
        k = Math.Min(b[0], b[1]);
        g = Convert.ToInt32(k);
    }
}

class Program
{
    static int cmp(Place a, Place b)
    {
        return b.g - a.g;
    }
    static void Main()
    {
        StreamReader read = new StreamReader(new FileStream("castle.in", FileMode.Open));
        StreamWriter write = new StreamWriter(new FileStream("castle.out", FileMode.Create));
        long[] ns = read.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
        Place[] p = new Place[ns[0]];
        for (int i = 0; i < ns[0]; i++)
            p[i] = new Place(read.ReadLine().Split().Select(x => long.Parse(x)).ToArray());
        Array.Sort(p, cmp);
        List<Place> l = p.ToList();
        long ans = 0;
        for (int i = 0; i < l.Count; i++)
        {
            if (ns[1] * l[i].k < l[i].a)
            {
                ans += l[i].a - ns[1] * l[i].k;
                ns[1] = 0;
            }
            else
            {
                ns[1] -= l[i].a / l[i].k;
                if (l[i].a % l[i].k != 0)
                {
                    long gg = l[i].a % l[i].k;
                    l[i] = new Place(new long[] { gg, gg });
                    int ll = 0, r = l.Count;
                    while (r - ll != 1)
                    {
                        int m = (ll + r) / 2;
                        if (l[m].k < l[i].k)
                            r = m;
                        else
                            ll = m;
                    }
                    l.Insert(ll + 1, l[i]);
                }
            }
        }
        write.WriteLine(ans);
        read.Close();
        write.Close();
    }
}