#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <set>

using namespace std;

int arr[105];

int main()
{
    freopen("castle.in", "r", stdin);
    freopen("castle.out", "w", stdout);

    long long n, s;
    cin >> n >> s;

    int t;
    for(int i = 0; i < n; i++) cin >> arr[i] >> t;

    int ans = 0;
    for(int i = 0; i < n; i++) ans += arr[i];

    ans -= s;
    if(ans < 0) ans = 0;

    cout << ans << endl;







    return 0;
}
