#include #include #include #include #include #include #include #include #include #include #include #define pb push_back #define all(x) begin(x), end(x) #define gall(x) begin(x), end(x), greater<>() #define ll long long #define rep(i,x) for(int i=0;i #define lP pair using namespace std; using namespace atcoder; using mint=modint998244353; const int INF=1e9; int main() { ll n,K; cin>>n>>K; vector a(n+1); for(int i=1;i<=n;i++) cin>>a[i]; ll ok=-1,ng=a[1]+K+5; while(ng-ok>1){ ll k=K; ll mid=(ok+ng)/2; ll s=0; for(ll i=1;i<=n;i++){ ll ai=a[i]+s; if(ai=0) ok=mid; else ng=mid; } cout<