const
  MaxN = 100010;
  MaxM = 100010;

var
  inFile, outFile : text;
  n, m, a, b, startIndex, i : longint;
  x : array[0..MaxN] of longint;
  sol : array[0..MaxM] of longint;

begin
	
	assign(inFile, 'upiti.in');
        assign(outFile, 'upiti.out');
	reset(inFile); rewrite(outFile);
	read(inFile, n, m);

	// indeksiramo niz od 0 jer je tako lakse
        for i := 0 to n - 1 do
	  read(inFile, x[i]);

	startIndex := 0;

	for i := 1 to m do begin
          read(inFile, a, b);
          if (a = 1) then startIndex := (startIndex + b) mod n
                     else writeln(outFile, x[(startIndex + b - 1) mod n]);
        end;

	close(inFile);
	close(outFile);

end.
