#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

#define INF 1791791791

int main()
{
#ifndef LOCAL
    freopen("castle.in", "r", stdin);
    freopen("castle.out", "w", stdout);
#endif
    int n, s;
    cin >> n >> s;
    vector<int> a(n), k(n);
    for (int i = 0; i < n; i++)
        cin >> a[i] >> k[i];
    int** dp = new int*[n];
    for (int i = 0; i < n; i++)
        dp[i] = new int[s + 1];
    for (int i = 0; i <= s; i++)
    {
        if (i * k[0] >= a[0])
            dp[0][i] = 0;
        else
            dp[0][i] = a[0] - i * k[0];
    }
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j <= s; j++)
        {
            dp[i][j] = INF;
            for (int t = 0; t <= min(j, a[i]); t++)
            {
                if (t * k[i] >= a[i])
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - t]);
                else
                    dp[i][j] = min(dp[i][j], dp[i - 1][j - t] + a[i] - t * k[i]);
            }
        }
    }
    cout << dp[n - 1][s] << endl;
    return 0;
}
