module FenwickTree: sig
    type t
    val make: int -> t
    val add:  t -> int -> int -> unit
    val sum:  t -> int -> int -> int
end= struct
    type t = int array

    let make n = Array.make n 0
    let add data p x =
        let n = Array.length data in
        let rec loop p =
            if p <= n then (
                data.(p - 1) <- data.(p - 1) + x;
                loop (p + (p land -p))
            )
        in
        loop (p + 1)

    let sum data l r =
        let sum' r =
            let rec loop r s =
                if r <= 0 then s else
                    loop (r - (r land -r)) (s + data.(r - 1))
            in
            loop r 0 
        in
        sum' r - sum' l
end ;;
Scanf.scanf "%d %d" (fun n q ->
    let ft = FenwickTree.make n in

    for i = 0 to n - 1 do
        Scanf.scanf " %d" (fun a -> FenwickTree.add ft i a)
    done;

    for i = 1 to q do
        Scanf.scanf " %d %d %d" (fun z p x ->
            if z = 0 then FenwickTree.add ft p x else
                Printf.printf "%d\n%!" @@ FenwickTree.sum ft p x
        )
    done
)