/**
 * Created by roi on 05.04.2016.
 */
import java.io.*;
import java.util.*;

public class A {
    String fileName = "castle";
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;
    public class par implements Comparable{
        long val;
        long eff;
        int key;
        par(long val, long eff, int key){
            this.val = val;
            this.eff = eff;
            this.key = key;
        }
        @Override
        public int compareTo(Object o) {
            par en = (par)o;
            if (this.eff < en.eff){
                return -1;
            }
            if (this.eff > en.eff){
                return 1;
            }
            if (this.val > en.val){
                return 1;
            }
            if (this.val < en.val){
                return -1;
            }
            if (this.key > en.key){
                return 1;
            }
            if (this.key < en.key){
                return -1;
            }
            return 0;
        }
    }
    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public void solve() throws IOException {
        // write your code here
        int n = nextInt();
        long s = nextLong();
        long[] a = new long[n];
        long[] k = new long[n];
        for (int i = 0; i < n; i++){
            a[i] = nextInt();
            k[i] = nextInt();
        }
        TreeSet<par> u = new TreeSet<par>();
        for (int i = 0; i < n; i++){
            u.add(new par(a[i],k[i],i));
        }
        boolean bo = true;
        par t;
        while (bo){
            t = u.last();
            if ((t.eff == 0)||(s == 0)){
                bo = false;
            }
            else{
                long res = Math.min(s, (t.val / t.eff));
                s -= res;
                u.remove(t);
                u.add(new par(t.val - res * t.eff, Math.min(t.val - res * t.eff, t.eff),t.key));
            }
        }
        Iterator h = u.iterator();
        long sum = 0;
        for (int i = 0; i < n; i++){
            t = (par)h.next();
            sum += t.val;
        }
        out.println(sum);
        out.close();
    }

    public void run() {
        try {
            br = new BufferedReader(new FileReader(fileName + ".in"));
            out = new PrintWriter(fileName + ".out");

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }


    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new A().run();
    }

}
