#include<bits/stdc++.h>
using namespace std; 

int main(){
  
    int m, n;
    cin >> m >> n;
    
    int aux = 1;
    int res = 0; 
        
    while(true){
        if(aux >= n){break;}
        --aux;
        aux += m;
        res++;
    }

    cout << res <<"\n";
    
    
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  int k,t;
  cin >> k >> t;
  vector<int> n(t);
  for(int i = 0;i < t;i++)cin >> n[i];
  sort(n.begin(),n.end());
  cout << max(0,n[t - 1] - (k - n[t - 1]) - 1) << endl;
}