/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */

#include <bits/stdc++.h>
//#include "../library/dsu.hpp"
#ifndef ATCODER_FENWICKTREE_HPP
#define ATCODER_FENWICKTREE_HPP 1

#ifndef ATCODER_INTERNAL_TYPE_TRAITS_HPP
#define ATCODER_INTERNAL_TYPE_TRAITS_HPP 1

#include <cassert>
#include <numeric>
#include <type_traits>

namespace atcoder {

    namespace internal {

#ifndef _MSC_VER
        template <class T>
        using is_signed_int128 =
        typename std::conditional<std::is_same<T, __int128_t>::value ||
                std::is_same<T, __int128>::value,
                                  std::true_type,
                                  std::false_type>::type;

        template <class T>
        using is_unsigned_int128 =
        typename std::conditional<std::is_same<T, __uint128_t>::value ||
                std::is_same<T, unsigned __int128>::value,
                                  std::true_type,
                                  std::false_type>::type;

        template <class T>
        using make_unsigned_int128 =
        typename std::conditional<std::is_same<T, __int128_t>::value,
                                  __uint128_t,
                                  unsigned __int128>;

        template <class T>
        using is_integral = typename std::conditional<std::is_integral<T>::value ||
                is_signed_int128<T>::value ||
                is_unsigned_int128<T>::value,
                                                      std::true_type,
                                                      std::false_type>::type;

        template <class T>
        using is_signed_int = typename std::conditional<(is_integral<T>::value &&
                std::is_signed<T>::value) ||
                is_signed_int128<T>::value,
                                                        std::true_type,
                                                        std::false_type>::type;

        template <class T>
        using is_unsigned_int =
        typename std::conditional<(is_integral<T>::value &&
                std::is_unsigned<T>::value) ||
                is_unsigned_int128<T>::value,
                                  std::true_type,
                                  std::false_type>::type;

        template <class T>
        using to_unsigned = typename std::conditional<
                is_signed_int128<T>::value,
                make_unsigned_int128<T>,
                typename std::conditional<std::is_signed<T>::value,
                                          std::make_unsigned<T>,
                                          std::common_type<T>>::type>::type;

#else

        template <class T> using is_integral = typename std::is_integral<T>;

template <class T>
using is_signed_int =
    typename std::conditional<is_integral<T>::value && std::is_signed<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using is_unsigned_int =
    typename std::conditional<is_integral<T>::value &&
                                  std::is_unsigned<T>::value,
                              std::true_type,
                              std::false_type>::type;

template <class T>
using to_unsigned = typename std::conditional<is_signed_int<T>::value,
                                              std::make_unsigned<T>,
                                              std::common_type<T>>::type;

#endif

        template <class T>
        using is_signed_int_t = std::enable_if_t<is_signed_int<T>::value>;

        template <class T>
        using is_unsigned_int_t = std::enable_if_t<is_unsigned_int<T>::value>;

        template <class T> using to_unsigned_t = typename to_unsigned<T>::type;

    }  // namespace internal

}  // namespace atcoder

#endif  // ATCODER_INTERNAL_TYPE_TRAITS_HPP


#include <vector>

namespace atcoder {

// Reference: https://en.wikipedia.org/wiki/Fenwick_tree
    template <class T> struct fenwick_tree {
        using U = internal::to_unsigned_t<T>;

    public:
        fenwick_tree() : _n(0) {}
        fenwick_tree(int n) : _n(n), data(n) {}

        void add(int p, T x) {
            assert(0 <= p && p < _n);
            p++;
            while (p <= _n) {
                data[p - 1] += U(x);
                p += p & -p;
            }
        }

        T sum(int l, int r) {
            assert(0 <= l && l <= r && r <= _n);
            return sum(r) - sum(l);
        }

    private:
        int _n;
        std::vector<U> data;

        U sum(int r) {
            U s = 0;
            while (r > 0) {
                s += data[r - 1];
                r -= r & -r;
            }
            return s;
        }
    };

}  // namespace atcoder

#endif  // ATCODER_FENWICKTREE_HPP

//#include "../library/modint.hpp"
//#include "../library/segtree.hpp"

using namespace std;
using namespace atcoder;

class BFenwickTree {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n, q;
        in >> n >> q;
        fenwick_tree<long long> fw(n);
        for (int i = 0; i < n; ++i) {
            int a;
            in >> a;
            fw.add(i, a);
        }
        while (q--) {
            int t;
            in >> t;
            if (t) {
                int l, r;
                in >> l >> r;
                out << fw.sum(l, r) << '\n';
            } else {
                int p, x;
                in >> p >> x;
                fw.add(p, x);
            }
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    BFenwickTree solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 8256