#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lim 100001
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll lazy[100001] = {0};
void buildTree(ll tree, ll ss, ll se, ll a[], ll index){
if(ss == se){
tree[index] = a[ss];
return;
}
ll mid = (ss+se)/2;
buildTree(tree,ss,mid, a,index2);
buildTree(tree, mid+1, se, a, index2 +1);
tree[index] = min(tree[index2], tree[index*2 + 1]);
}
void updateLazy(ll tree, ll ss ,ll se, ll i, ll inc, ll index){
//before going down resolve the lazy value if it exists
if(lazy[index] != 0){
tree[index] += lazy[index];
//non leaf node
if( ss != se){
lazy[index2] += lazy[index];
lazy[index2 + 1] += lazy[index];
}
lazy[index] = 0;
}
//base case
// no onverlap
if(ss > i || i > se){
return;
}
// complete overlap
if(ss >= i && se <= i){
tree[index] += inc;
//create new lazy value of child nodes
if(ss != se){
lazy[index2] += inc;
lazy[index2 + 1] += inc;
}
return;
}
//recursive case
ll mid = (ss+se)/2;
updateLazy(tree,ss,mid,i,inc,index2);
updateLazy(tree,mid+1, se, i, inc, index2 + 1);
tree[index] = min(tree[index2], tree[index*2 + 1]);
}
ll queryLazy(ll tree, ll ss ,ll se, ll qs, ll qe, ll index){
if(lazy[index] != 0){
tree[index] += lazy[index];
//non leaf node
if( ss != se){
lazy[index2] += lazy[index];
lazy[index*2 + 1] += lazy[index];
}
lazy[index] = 0;
}
//query logic
//base case no overlap
if(ss > qe || se < qs){
return INT_MAX;
}
//complete overlap
if(ss >= qs && se <= qe){
return tree[index];
}
ll mid = (ss+se)/2;
ll left = queryLazy(tree,ss,mid,qs,qe,2*index);
ll right = queryLazy(tree, mid+1, se, qs, qe, index*2 + 1);
return min(left, right);
}
int main(){
fast;
ll n, q;
cin >> n >> q;
ll a[n];
for(int i=0;i<n;i++) cin >> a[i];
ll tree = new ll [4n + 1];
buildTree(tree, 0, n-1, a, 1);
while(qβ){
ll m, x, y;
cin >> m >> x >> y;
x -= 1; y -= 1;
if( m == 1){
cout << queryLazy(tree, 0, n-1, x, y, 1) << "\n";
}
else {
updateLazy(tree, 0, n-1, x, y, 1);
}
}
}