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

public class main {
	String fileName = "castle";

	class pair implements Comparable<pair> {
		@Override
		public String toString() {
			return "pair [a=" + a + ", b=" + b + ", i=" + i + "]";
		}

		int a;
		int b;
		int i;

		pair(int a, int b, int i) {
			this.a = a;
			this.b = b;
			this.i = i;
		}

		@Override
		public int compareTo(pair q) {
			if (this.b > q.b)
				return -1;
			if (this.b < q.b)
				return 1;
			if (this.a > q.a)
				return -1;
			if (this.a < q.a)
				return 1;
			if (this.i > q.i)
				return -1;
			if (this.i < q.i)
				return 1;

			return 0;
		}
	}

	public void solve() throws IOException {
		int n = nextInt();
		long s = nextLong();
		pair[] a = new pair[n];
		TreeSet<pair> tr = new TreeSet<pair>();
		for (int i = 0; i < a.length; i++) {
			a[i] = new pair(nextInt(), nextInt(), i);
			tr.add(a[i]);
		}
		long res = 0;
		while (s > 0 && !tr.isEmpty()) {
			pair t = tr.pollFirst();
			int k = t.a / t.b;
			if (k == 0) {
				t.b = t.a;
				tr.add(t);
			} else {
				if (s >= k) {
					s -= k;
					t.a -= k * t.b;
				} else {
					t.a -= s * t.b;
					s = 0;
				}
				if (t.a != 0) {
					tr.add(t);
				}
			}
		}
		while (!tr.isEmpty()) {
			res += tr.pollFirst().a;
		}
		out.println(res);
	}

	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 main().run();
	}

}