fun main(args : Array<String>) {
    val (n, q) = readLine()!!.split(" ").map { it.toInt() }
    val aa = readLine()!!.split(" ").map { it.toInt() }
    val bits = BIT(n)

    aa.forEachIndexed { idx, a ->
        bits.add(idx, a)
    }

    repeat(q) {
        val (t, u, v) = readLine()!!.split(" ").map { it.toInt() }
        if (t == 0) {
            bits.add(u, v)
        } else {
            println(bits.sum(u, v))
        }
    }
}

private data class BIT(val size: Int) {
    private val data = MutableList(this.size){0L}

    fun add(idx: Int, value: Int) {
        var i = idx+1
        while (i <= this.size) {
            this.data[i-1] += value.toLong()
            i += i and -i
        }
    }

    // NOTE: data[rIdx] is not included
    fun sum(rIdx: Int): Long {
        var i = rIdx
        var sum = 0L

        while (i > 0) {
            sum += this.data[i-1]
            i -= i and -i
        }

        return sum
    }

    // NOTE: data[rIdx] is not included
    fun sum(lIdx: Int, rIdx: Int): Long {
        return sum(rIdx)-sum(lIdx)
    }
}