use proconio::input;

// use my::algebra::Additive;
// use my::ds::vec_segtree::*;

fn main() {
    input! {
        n: usize,
        q: usize,
        a: [i64; n],
    }

    let mut st: VecSegtree<Additive<i64>> = a.into();

    for _ in 0..q {
        input! { t: u32 }
        match t {
            0 => {
                input! {
                    p: usize,
                    x: i64,
                }
                st.set_value(p, st[p] + x);
            }
            1 => {
                input! {
                    l: usize,
                    r: usize,
                }
                println!("{}", st.fold(l..r));
            }
            _ => {}
        }
    }
}

// -------- Following codes are bundled automatically. -------- //

pub mod algebra {
    pub mod structures {
        pub trait Magma {
            type Set: Copy;
            fn op(lhs: Self::Set, rhs: Self::Set) -> Self::Set;
            fn op_assign(lhs: &mut Self::Set, rhs: Self::Set);
        }
        pub trait Semigroup: Magma {
            // Operation should be associative.
        }
        pub trait Monoid: Semigroup {
            fn id() -> Self::Set;
        }
        pub trait Group: Monoid {
            fn inv(x: Self::Set) -> Self::Set;
        }
        pub trait AbelianMonoid: Monoid {
            // Operation should be commutative.
        }
        pub trait AbelianGroup: Group {
            // Operation should be commutative.
        }
    }
    pub use structures::*;

    pub mod additive {
        use crate::algebra::Zero;
        use std::marker::PhantomData;
        use std::ops::{Add, AddAssign, Neg};

        use crate::algebra::{
            AbelianGroup, AbelianMonoid, Group, Magma, Monoid, Semigroup,
        };
        pub struct Additive<T> {
            p_: PhantomData<T>,
        }
        impl<T: Copy + Add<Output = T> + AddAssign> Magma for Additive<T> {
            type Set = T;
            fn op(lhs: T, rhs: T) -> T {
                lhs + rhs
            }
            fn op_assign(lhs: &mut T, rhs: T) {
                *lhs += rhs;
            }
        }
        impl<T: Copy + Add<Output = T> + AddAssign> Semigroup for Additive<T> {}
        impl<T: Copy + Add<Output = T> + AddAssign + Zero> Monoid for Additive<T> {
            fn id() -> T {
                T::zero()
            }
        }
        impl<T> Group for Additive<T>
        where
            T: Copy + Add<Output = T> + AddAssign + Zero + Neg<Output = T>,
        {
            fn inv(x: T) -> T {
                -x
            }
        }
        impl<T> AbelianMonoid for Additive<T> where
            T: Copy + Add<Output = T> + AddAssign + Zero
        {
        }
        impl<T> AbelianGroup for Additive<T> where
            T: Copy + Add<Output = T> + AddAssign + Zero + Neg<Output = T>
        {
        }
    }
    pub use additive::*;

    pub mod identities {
        use std::ops::{Add, Mul};
        pub trait Zero: Sized + Add<Self, Output = Self> {
            fn zero() -> Self;
            fn set_zero(&mut self) {
                *self = Zero::zero();
            }
            fn is_zero(&self) -> bool;
        }
        pub trait One: Sized + Mul<Self, Output = Self> {
            fn one() -> Self;
            fn set_one(&mut self) {
                *self = One::one();
            }
            fn is_one(&self) -> bool;
        }
        macro_rules! impl_id {

            ( $($ty:ty,)* ) => { $(
                impl Zero for $ty {
                    fn zero() -> Self {
                        return 0 as $ty;
                    }
                    fn is_zero(&self) -> bool {
                        return *self == 0 as $ty;
                    }
                }
                impl One for $ty {
                    fn one() -> Self {
                        return 1 as $ty;
                    }
                    fn is_one(&self) -> bool {
                        return *self == 1 as $ty;
                    }
                }
            )* }
        }
        impl_id! {

            i8, i16, i32, i64, i128,
            u8, u16, u32, u64, u128,
        }
    }
    pub use identities::*;
}

pub mod ds {
    pub mod vec_segtree {
        use crate::algebra::Monoid;
        use std::convert::From;
        use std::iter::FromIterator;

        use crate::ds::BufRange;
        #[doc(hidden)]
        pub use crate::ds::{Fold, SetValue};
        pub struct VecSegtree<M: Monoid> {
            buf: Vec<M::Set>,
            len: usize,
        }
        impl<M: Monoid> VecSegtree<M> {
            pub fn new(len: usize) -> Self {
                VecSegtree {
                    buf: vec![M::id(); len + len],
                    len: len + len,
                }
            }
        }
        impl<M: Monoid> std::ops::Index<usize> for VecSegtree<M> {
            type Output = M::Set;
            fn index(&self, i: usize) -> &M::Set {
                &self.buf[i + self.len]
            }
        }
        impl<M: Monoid, R: BufRange> Fold<R> for VecSegtree<M> {
            type Output = M::Set;
            fn fold(&self, irange: R) -> M::Set {
                let (mut l, mut r) = irange.bounds_within(self.len);
                let (mut resl, mut resr) = (M::id(), M::id());
                if r > self.len || l >= r {
                    return resl;
                }
                l += self.len;
                r += self.len;
                while l < r {
                    if l & 1 == 1 {
                        M::op_assign(&mut resl, self.buf[l]);
                        l += 1;
                    }
                    if r & 1 == 1 {
                        r -= 1;
                        resr = M::op(self.buf[r], resr);
                    }
                    l >>= 1;
                    r >>= 1;
                }
                M::op(resl, resr)
            }
        }
        impl<M: Monoid> SetValue<usize, M> for VecSegtree<M> {
            fn set_value(&mut self, i: usize, x: M::Set) {
                let mut i = i + self.len;
                self.buf[i] = x;
                while i > 0 {
                    i >>= 1;
                    self.buf[i] =
                        M::op(self.buf[i << 1 | 0], self.buf[i << 1 | 1]);
                }
            }
        }
        impl<M: Monoid> From<Vec<M::Set>> for VecSegtree<M> {
            fn from(mut base: Vec<M::Set>) -> Self {
                let len = base.len();
                let mut buf = vec![M::id(); len];
                buf.append(&mut base);
                for i in (1..len).rev() {
                    buf[i] = M::op(buf[i << 1 | 0], buf[i << 1 | 1]);
                }
                VecSegtree { buf, len }
            }
        }
        impl<M: Monoid> FromIterator<M::Set> for VecSegtree<M> {
            fn from_iter<I: IntoIterator<Item = M::Set>>(iter: I) -> Self {
                Self::from(Vec::from_iter(iter))
            }
        }
    }
    pub use vec_segtree::*;

    pub mod range_query {
        use std::ops::Bound::*;

        use crate::algebra::Monoid;
        use std::ops::RangeBounds;
        use std::ops::{
            Range, RangeFrom, RangeFull, RangeInclusive, RangeTo,
            RangeToInclusive,
        };

        pub trait BufRange: RangeBounds<usize> {
            fn bounds_within(&self, len: usize) -> (usize, usize) {
                let s_in = match self.start_bound() {
                    Included(&i) => i,
                    Excluded(&i) => i + 1,
                    Unbounded => 0,
                };
                let e_ex = match self.end_bound() {
                    Included(&i) => i + 1,
                    Excluded(&i) => i,
                    Unbounded => len,
                };
                (s_in, e_ex)
            }
        }
        impl BufRange for Range<usize> {}

        impl BufRange for RangeFrom<usize> {}
        impl BufRange for RangeFull {}
        impl BufRange for RangeInclusive<usize> {}
        impl BufRange for RangeTo<usize> {}
        impl BufRange for RangeToInclusive<usize> {}
        pub trait Fold<R: BufRange> {
            type Output;
            fn fold(&self, irange: R) -> Self::Output;
        }
        pub trait SetValue<I, T: Monoid> {
            fn set_value(&mut self, index: I, el: T::Set);
        }
    }
    pub use range_query::*;
}

use crate::algebra::Additive;
use crate::ds::vec_segtree::*;


Measured memory_bytes: 26916