//In the name of Allah
#include <bits/stdc++.h>
using namespace std;

const int Sq = 321, N = Sq * Sq;
long long n, q, a[N], last[N], lazy[Sq], cnt[Sq];

int parent(int u) {
	return max(0ll, a[u] - lazy[u / Sq]);
}

void handle(int l, int val = 1) {
	cnt[l / Sq] += val;
	if (cnt[l / Sq] > Sq)
		return;
	for (int u = l; u < l + Sq && u < n; u++) 
		last[u] = parent(u) < l? u: last[parent(u)];
}

void update(int l, int r, int val) {
	int L = l, R = r;
	while (l < r)
		if (l % Sq != 0 || l + Sq > r) {
			a[l] -= val;
			l++;
		}
		else {
			lazy[l / Sq] += val;
			handle(l);
			l += Sq;
		}
	handle(L / Sq * Sq, 0);
	handle((R - 1) / Sq * Sq, 0);
}

int lca(int u, int v) {
	while (u != v) {
		u = parent(u / Sq != v / Sq || last[u] != last[v]? last[u]: u);
		if (u < v)
			swap(u, v);
	}
	return u;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> q;
	for (int i = 1; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	for (int i = 0; i < n; i += Sq)
		handle(i);
	while (q--) {
		int type;
		cin >> type;
		if (type == 1) {
			int l, r, x;
			cin >> l >> r >> x;
			update(--l, r, x);
		}
		else {
			int u, v;
			cin >> u >> v;
			if (u < v)
				swap(u, v);
			cout << lca(--u, --v) + 1 << endl;
		}
	}
}