#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n, m;
cin >> n >> m;
vector<long long> a(1000005, 0);
vector<long long> output;
for (long long i = 1; i <= n; i++)
{
cin >> a[i];
}
for (long long i = 0; i < m; i++)
{
int type;
cin >> type;
if (type == 1)
{
long long x, y;
cin >> x >> y;
if (x >= 1 && x <= n)
{
for (long long k = 1; k <= n/x; k++)
{
a[x * k] += y;
}
}
}
else if (type == 2)
{
long long j;
cin >> j;
if (j >= 0 && j <= n)
{
output.push_back(a[j]);
}
}
}
for (long long result : output)
{
cout << result << endl;
}
return 0;
}