#include <bits/stdc++.h>
#define ll long long
#define pi 3.14159265358979
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

int main(){
    ll n,r,k;
    cin>>n>>r;
    if(n>=10){
        k=0;
    }else{
        k=1000-100*n;
    }
    cout<<r+k;
}
#include <bits/stdc++.h>
#include <climits>
#include <sstream>
using namespace std;

int main(){

    int K,T;
    cin >> K >> T;
    int A[T];
    int mx = 0;
    for(int i = 0;i < T;i++){
        cin >> A[i];
        mx = max(mx,A[i]);
    }
    
    cout << max(0,mx-1-(K-mx))<<endl;
}

