export default class FenwickTree {
    /**
     * Constructor creates empty fenwick tree of size 'arraySize',
     * however, array size is size+1, because index is 1-based.
     *
     * @param  {number} arraySize
     */
    arraySize;
    treeArray;
    constructor(arraySize) {
        this.arraySize = arraySize;

        // Fill tree array with zeros.
        this.treeArray = Array(this.arraySize + 1).fill(0);
    }

    /**
     * Adds value to existing value at position.
     *
     * @param  {number} position
     * @param  {number} value
     * @return {FenwickTree}
     */
    increase(position, value) {
        if (position < 1 || position > this.arraySize) {
            throw new Error('Position is out of allowed range');
        }

        for (let i = position; i <= this.arraySize; i += (i & -i)) {
            this.treeArray[i] += value;
        }

        return this;
    }

    /**
     * Query sum from index 1 to position.
     *
     * @param  {number} position
     * @return {number}
     */
    query(position) {
        if (position < 1 || position > this.arraySize) {
            throw new Error('Position is out of allowed range');
        }

        let sum = 0;

        for (let i = position; i > 0; i -= (i & -i)) {
            sum += this.treeArray[i];
        }

        return sum;
    }

    /**
     * Query sum from index leftIndex to rightIndex.
     *
     * @param  {number} leftIndex
     * @param  {number} rightIndex
     * @return {number}
     */
    queryRange(leftIndex, rightIndex) {
        if (leftIndex > rightIndex) {
            throw new Error('Left index can not be greater than right one');
        }

        if (leftIndex === 1) {
            return this.query(rightIndex);
        }

        return this.query(rightIndex) - this.query(leftIndex - 1);
    }
}

let input = require("fs").readFileSync("/dev/stdin", "utf8"); let cin = input.split(/ |\n/), cid = 0; function next() { return +cin[cid++]; }function nexts(n,a?){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}//input from catoonさん


//go();//黒魔術ですよ

function main() {
    let ans = [];
    let n = next();
    let q = next();
    let bit = new FenwickTree(n+1);
    // let tmp = nexts(n);
    for(let i =0;i<n;i++){
        bit.increase(i+1,next());
    }
    for (let i = 0; i < q; i++) {
        let x = next();
        let l = next();
        let r = next();
        if (x === 1) {
            ans.push(bit.queryRange(l+1,r));
        }
        else{
            bit.increase(l+1,r);
        }
    }
    let rick = ans.join('\n');
    return rick;
}












let stream = process.stdout;
function write(data, n) { if (!stream.write(data)) { stream.once('drain', n); } else { process.nextTick(n); } } write(main(), next);

function go(){var i=require("util"),u={};function o(f?,t?){f=f||8192,Object.keys(u).forEach(function(e){console[e]=function(){var o=i.format.apply(this,arguments);"string"==typeof t?o=t+o:"function"==typeof t&&(o=t()+o);var n=Buffer.byteLength(o);u[e].size+=n,u[e].buf.push(o),u[e].size>f&&c()}})}function c(){Object.keys(u).forEach(function(o){u[o].size&&u[o].func(u[o].buf.join("\n")),u[o].buf.length=0,u[o].size=0})}process.on("exit",c),module.exports=o,module.exports.flush=c,["warn","log","error","info"].forEach(function(o){u[o]={func:console[o].bind(console),size:0,buf:[]}}),o()}



Measured memory_bytes: 220692