from atcoder.segtree import SegTree n,q = map(int,input().split()) a = list(map(int,input().split())) st = SegTree(max, -25252525252525252525252525252525252525252521, a) for i in range(q): t,x,y = map(int,input().split()) if t == 1: st.set(t,st.get(t)+y) else: print(st.prod(x-1,y))