import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {

    PrintWriter out;
    FastScanner in;

    String FILE = "castle";

    static final int MAXK = 105;

    int n;
    long s;

    public void solve() {
        n = in.nextInt();
        s = in.nextLong();
        long ms[] = new long[MAXK];

        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), k = in.nextInt();
            ms[k] += a / k;
            ms[a % k]++;
        }

        long ans = 0;

        for (int i = MAXK - 1; i >= 1; i--) {
            long mini = min(ms[i], s);
            ms[i] -= mini;
            s -= mini;
            ans += ms[i] * i;
        }

        out.print(ans);
    }

    public void run() {
        if (!FILE.isEmpty()) {
            try {
                in = new FastScanner(new FileReader(FILE + ".in"));
                out = new PrintWriter(FILE + ".out");
            } catch (IOException e) {
                e.printStackTrace();
                System.exit(1);
            }
        } else {
            in = new FastScanner(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        }

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer in;

        public FastScanner(Reader reader) {
            br = new BufferedReader(reader);
        }

        public String nextToken() {
            while (in == null || !in.hasMoreTokens()) {
                try {
                    in = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return in.nextToken();
        }

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

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

        public long nextLong() {
            return Long.parseLong(nextToken());
        }
    }

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

}