#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,T,K=0;
  cin >> N >> T;
  vector<int> A(T);
  for(int i=0;i<T;i++){
    cin >> A[i];
    K+=A[i];
  }
  sort(A.begin(),A.end());
  K-=(2*A[T-1]-1);
  if(K>=0) cout << 0 << endl;
  else cout << K*-1 << endl;
}