import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] num = new int[n + 1];
        int[] dp = new int[n + 1];
        for(int i = 1; i <= n; ++i){
            num[i] = sc.nextInt();
        }

        for(int i = 0; i < m; ++i){
            int key = sc.nextInt();
            switch(key){
                case 1:
                    int k = sc.nextInt();
                    System.out.println(dp[k]);
                    break;
                case 2:
                    int x = sc.nextInt();
                    int v = sc.nextInt();
                    while(true && x <= n){
                        if(dp[x] + v <= num[x]){
                            dp[x] += v;
                            break;
                        }else{
                            v -= (num[x] - dp[x]);
                            dp[x] = num[x];
                            x++;
                        }
                    }
                    break;
                default:
                    break;
            }
        }
    }
}