import java.io.*;
import java.util.*;

public class Castle {
    String fileName = "castle";

    public void solve() throws IOException {
        int n = nextInt(), s = nextInt();

        TreeSet<Segment> segments = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            segments.add(new Segment(nextInt(), nextInt(), i));
        }

        int count = 0;
        while (s > 0 && !segments.isEmpty()) {
            Segment seg = segments.pollFirst();
            if (seg.a % seg.k == 0) {
                if (seg.a / seg.k < s) {
                    s -= seg.a / seg.k;
                } else {
                    seg.a -= seg.k * s;
                    s = 0;
                    count += seg.a;
                }
            } else {
                if (seg.a / seg.k < s) {
                    s -= seg.a / seg.k;
                    seg.a %= seg.k;
                    seg.k = seg.a;
                } else {
                    seg.a -= seg.k * s;
                    s = 0;
                }
                segments.add(seg);
            }
        }

        for (Segment seg : segments) {
            count += seg.a;
        }

        out.println(count);
    }

    private class Segment implements Comparable<Segment> {
        long a, k;
        int num;

        public Segment(int a, int k, int num) {
            this.a = a;
            this.k = k;
            this.num = num;
        }

        @Override
        public int compareTo(Segment o) {
            if (k == o.k) {
                return Integer.compare(num, o.num);
            } else {
                return Long.compare(o.k, k);
            }
        }
    }

    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);
        }
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    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 static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Castle().run();
    }

}