#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
long long n, s, b, c, BIG;
vector <vector<long long> > a;
vector <long long> tree;
int update(long long x){
    if (x == 0)
        return 0;
    long long m = (x - 1) / 2;
    tree[m] = max(tree[2 * m + 1], tree[2 * m + 2]);
    update(m);
    return 0;
}
int max1(long long x){
    if (2 * x + 1 > BIG){
        return x;
    }
    if (tree[2 * x + 1] > tree[2 * x + 2]){
        return max1(2 * x + 1);
    }
    else{
        return max1(2 * x + 2);
    }
}
int main()
{
    freopen("castle.in", "r", stdin);
    freopen("castle.out", "w", stdout);
    cin >> n >> s;
    a.resize(n);
    BIG = 262144;
    tree.resize(BIG + 1);
    for (int i = 0; i < n; i++){
        a[i].resize(2);
        cin >> a[i][0] >> a[i][1];
        tree[BIG / 2 + i + 1] = a[i][1];
        update(BIG / 2 + i + 1);
    }
    while(s > 0){
        int x = max1(0);
        int i = x - BIG / 2 - 1;
        if (tree[x] == 0){
            cout << 0;
            exit(0);
        }
        int y = a[i][0] / tree[x];
        s -= y;
        a[i][0] -= y * tree[x];
        tree[x] = a[i][0];
        update(x);
    }
    long long ans = 0;
    for (int j = BIG / 2; j < BIG + 1; j++){
        ans += tree[j];
    }
    cout << ans;
    return 0;
}
