#include <bits/stdc++.h>
#define il inline
#define ll long long
const int N=2e5+5,B=316;

int n,q,b[N],c[N]; ll a[N],lz[N];

il int jump(int x){return x?std::max(a[x]-lz[x/B],0ll):-1;}

il void rebuild(int x,int v)
{
	if (c[x]+v>B) return ; c[x]+=v; int i;
	for (i=x*B; i<x*B+B; i++) b[i]=jump(i)<x*B?i:b[jump(i)];
}

il void add(int x,int y,int v)
{
	int i; for (i=x/B*B; i<x; i++) a[i]+=v;
	for (i=y+1; i<y/B*B+B; i++) a[i]+=v;
	for (i=x/B; i<=y/B; i++) lz[i]+=v,rebuild(i,i!=x/B&&i!=y/B);
}

il int LCA(int x,int y)
{
	for ( ; b[x]!=b[y]; x=jump(b[x])) if (jump(b[x])<jump(b[y])) std::swap(x,y);
	for ( ; x!=y; x=jump(x)) if (x<y) std::swap(x,y); return x;
}

int main()
{
	scanf("%d%d",&n,&q),a[0]=-1; int i,x,y,k;
	for (i=1; i<n; i++) scanf("%d",a+i),a[i]--;
	
	for (add(0,n-1,0); q; q--)
		if (scanf("%d%d%d",&i,&x,&y),i>1) printf("%d\n",LCA(x-1,y-1)+1);
		else scanf("%d",&k),add(x-1,y-1,k);
	
	return 0;
}