import java.util.*

fun main() {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

class FenwickTree(private val n: Int = 0) {
    private val data = LongArray(n)

    fun add(p: Int, x: Long) {
        var pp = p + 1
        while (pp <= n) {
            data[pp - 1] += x
            pp += pp and -pp
        }
    }

    fun sum(l: Int, r: Int): Long = sum(r) - sum(l)

    private fun sum(r: Int): Long {
        var s = 0L
        var rr = r
        while (rr > 0) {
            s += data[rr - 1]
            rr -= rr and -rr
        }
        return s
    }
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val Q = sc.next().toInt()
        val ft = FenwickTree(N)
        repeat(N) { i ->
            ft.add(i, sc.next().toLong())
        }
        repeat(Q) {
            if (sc.next().toInt() == 0) {
                val p = sc.next().toInt()
                val x = sc.next().toLong()
                ft.add(p, x)
            } else {
                val l = sc.next().toInt()
                val r = sc.next().toInt()
                pw.println(ft.sum(l, r))
            }
        }
    }
}
