// Arup Guha
// 10/29/2013
// Solution to 2008 MCPC Problem D: The Bridges of San Mochti

import java.util.*;

class bridge {

	public int capacity;
	public int duration;

	public bridge(int c, int d) {
		capacity = c;
		duration = d;
	}
}

public class d {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = -stdin.nextInt();
		int people = stdin.nextInt();

		// Go through each case.
		while (n != 0) {

			// Initial times of all people.
			bridge[] bridges = new bridge[n];

			// Read in bridge data.
			for (int i=0; i<n; i++) {
				int capacity = stdin.nextInt();
				int crosstime = stdin.nextInt();
				bridges[i] = new bridge(capacity, crosstime);
			}

			// Print when last guy gets to the end.
			System.out.println(solve(bridges, people));

			// Get next case.
			n = -stdin.nextInt();
			people = stdin.nextInt();
		}


	}

	// Given that people are ready to cross at times stored in times, and that they are
	// crossing one bridge with capacity and crossTime, this method returns when the last
	// man crosses.
	public static int solve(bridge[] bridges, int people) {

		int n = bridges.length;

		// Will store how many people are waiting for each bridge, how many are on each bridge, and
		// what time each bridge will be unloaded.
		int[] waiting = new int[n];
		int[] onBridge = new int[n];
		int[] timeOff = new int[n];

		// Don't want to confuse this with people getting off a bridge at time 0.
		Arrays.fill(timeOff, -1);

		// Initial conditions.
		waiting[0] = people;
		int done=0, curTime=0;

		// Keep on going until no people are left.
		while (done < people) {

			int nextTime = getNextTime(waiting, onBridge, timeOff, curTime);
			curTime = nextTime;

			// Just process forwards so that everyone moves as far forward as possible.
			for (int i=0; i<n; i++) {

				// Next event to be processed is getting off bridge i.
				if (onBridge[i] > 0 && timeOff[i] == nextTime) {

					int group = onBridge[i];
					onBridge[i] = 0;
					timeOff[i] = -1;

					// Not the last bridge.
					if (i < n-1) {

						// Next bridge is free, so put on as many people as we can.
						if (onBridge[i+1] == 0) {
							onBridge[i+1] = Math.min(bridges[i+1].capacity, group);
							waiting[i+1] += Math.max(0, group - bridges[i+1].capacity);
							timeOff[i+1] = nextTime + bridges[i+1].duration;
						}

						// Or, we all wait...
						else {
							waiting[i+1] += group;
						}
					}

					// Last bridge, so these people are done!
					else {
						done += group;
					}
				}

				// Now we process people waiting for this bridge.
				if (waiting[i] > 0 && onBridge[i] == 0) {
					onBridge[i] = Math.min(bridges[i].capacity, waiting[i]);
					waiting[i] = Math.max(0, waiting[i] - bridges[i].capacity);
					timeOff[i] = nextTime + bridges[i].duration;
				}

			}
		}

		// This is when we finished.
		return curTime;
	}

	// Returns the next time an event occurs, given the # of people waiting at each bridge, the number of people on each
	// bridge, the time those people will get off and the current time.
	public static int getNextTime(int[] waiting, int[] onBridge, int[] timeOff, int curtime) {

		int best = 1000000000;
		int n = waiting.length;

		// See if people are waiting that can go on.
		for (int i=0; i<n; i++)
			if (waiting[i] > 0 && onBridge[i] == 0)
				return curtime;

		// Next, see if some people are on a bridge and get finish that bridge.
		for (int i=0; i<n; i++)
			if (onBridge[i] > 0 && timeOff[i] < best)
				best = timeOff[i];

		return best;
	}
}