#include <bits/stdc++.h>
using namespace std;
const long long int inf = (long long int)2e18;
const int mod = 1e9 + 7;
bool overflow(long long int a, long long int b) {
  if (a <= (inf + b - 1) / b) return false;
  return true;
}
const int NAX = 1e5 + 5;
long long int lazy[4 * NAX];
long long int calc(long long int p, long long int l, long long int r,
                   long long int k) {
  long long int x = (l - p + k) * (r - l);
  x += (r - l) * (r - l + 1) / 2;
  return x;
}
void shift(int i, long long int l, long long int r) {
  if (lazy[i]) {
    long long int x = (r - l) * (r - l + 1) / 2;
    long long int mid = (l + r) / 2;
    lazy[2 * i] = calc(l, l, mid, 0);
    lazy[2 * i + 1] = calc(l, mid, r, 0);
    lazy[i] -= x;
    lazy[i] /= (r - l);
    lazy[2 * i] += (mid - l) * lazy[i];
    lazy[2 * i + 1] += (r - mid) * lazy[i];
  }
  lazy[i] = 0;
}
void update(int i, long long int l, long long int r, long long int p,
            long long int q, long long int k) {
  if (l >= q || r <= p) return;
  if (l >= p && r <= q) {
    lazy[i] = calc(p, l, r, k);
    return;
  }
  int mid = (l + r) / 2;
  shift(i, l, r);
  update(2 * i, l, mid, p, q, k);
  update(2 * i + 1, mid, r, p, q, k);
}
int query(int i, int l, int r, int p) {
  if (r - l < 2) {
    return lazy[i];
  }
  int mid = (l + r) / 2;
  shift(i, l, r);
  if (p >= mid)
    return query(2 * i + 1, mid, r, p);
  else
    return query(2 * i, l, mid, p);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m, i;
  cin >> n >> m;
  int a[n], b[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  while (m--) {
    int type;
    cin >> type;
    if (type - 1) {
      int ind;
      cin >> ind;
      int x = query(1, 0, n, ind - 1);
      if (x)
        cout << a[x - 1] << "\n";
      else
        cout << b[ind - 1] << "\n";
    } else {
      int x, y, k;
      cin >> y >> x >> k;
      update(1, 0, n, x - 1, x + k - 1, y - 1);
    }
  }
}
