#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
multiset<ii> buc[MAXS];

void init() {
	ren = 750;
	for (int i = 0; i < N; i++) {
		buc[i/ren].insert({arr[i], i});
	}
}

void update(int l, int r, int v) {
	int i = l;
	while (i <= r && i%ren != 0) {
		buc[i/ren].erase({arr[i], i});
		arr[i] += v;
		buc[i/ren].insert({arr[i], i});
		i++;
	}
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	while (i <= r) {
		buc[i/ren].erase({arr[i], i});
		arr[i] += v;
		buc[i/ren].insert({arr[i], i});
		i++;
	}
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = buc[i/ren].lower_bound({v-lz[i/ren], 0});
		auto ub = prev(buc[i/ren].upper_bound({v-lz[i/ren], INF}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void update(int l, int r, int v) {
	int i = l;
	vector<vector<ii>::iterator> temp;
	while (i <= r && i%ren != 0) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	temp.clear();
	while (i <= r) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	sort(buc[l/ren].begin(), buc[l/ren].end());
	sort(buc[r/ren].begin(), buc[r/ren].end());
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], 0});
		auto ub = prev(upper_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], INF}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void update(int l, int r, int v) {
	int i = l;
	vector<vector<ii>::iterator> temp;
	while (i <= r && i%ren != 0) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	temp.clear();
	while (i <= r) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	sort(buc[l/ren].begin(), buc[l/ren].end());
	sort(buc[r/ren].begin(), buc[r/ren].end());
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], 0});
		if (lb->a != v-lz[i/ren]) {
			i += ren;
			continue;
		}
		auto ub = upper_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], INF});
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void update(int l, int r, int v) {
	int i = l;
	while (i <= r && i%ren != 0) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		pos->a = arr[i];
		i++;
	}
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	while (i <= r) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		pos->a = arr[i];
		i++;
	}
	sort(buc[l/ren].begin(), buc[l/ren].end());
	sort(buc[r/ren].begin(), buc[r/ren].end());
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], 0});
		auto ub = prev(upper_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], INF}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a;
	int b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren, l, r;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void subupdate(int l, int r, int v) {
	int b = l/ren;
	assert(l/ren == r/ren);
	vector<vector<ii>::iterator> temp;
	for (int i = l; i <= r; i++) {
		auto pos = lower_bound(buc[b].begin(), buc[b].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
	}
	for (auto i: temp) i->a = arr[i->b];
	sort(buc[b].begin(), buc[b].end());
}

void update(int l, int r, int v) {
	int bl = l/ren, br = r/ren;
	if (bl == br) subupdate(l, r, v);
	else {
		subupdate(l, bl*ren+ren-1, v);
		for (int i = bl+1; i < br; i++) lz[i] += v;
		subupdate(br*ren, r, v);
	}
}

void subquery(int ll, int rr, int v) {
	int b = ll/ren;
	for (int i = ll; i <= rr; i++) {
		if (arr[i]+lz[b] == v) {
			l = min(l, i);
			r = max(r, i);
		}
	}
}

void query(int v) {
	l = INF, r = -INF;
	int bl = 0/ren, br = (N-1)/ren;
	if (bl == br) subquery(0, N-1, v);
	else {
		subquery(0, bl*ren+ren-1, v);
		for (int i = bl+1; i < br; i++) {
			auto lb = lower_bound(buc[i].begin(), buc[i].end(), (ii){v-lz[i], 0});
			auto ub = upper_bound(buc[i].begin(), buc[i].end(), (ii){v-lz[i], INF});
			if (lb == buc[i].end() || lb->a != v-lz[i]) continue;
			l = min(l, lb->b);
			r = max(r, prev(ub)->b);
		}
		subquery(br*ren, N-1, v);
	}
	if (l == INF) puts("-1");
	else printf("%d\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
multiset<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].insert({arr[i], i});
	}
}

void update(int l, int r, int v) {
	int i = l;
	while (i <= r && i%ren != 0) {
		buc[i/ren].erase({arr[i], i});
		arr[i] += v;
		buc[i/ren].insert({arr[i], i});
		i++;
	}
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	while (i <= r) {
		buc[i/ren].erase({arr[i], i});
		arr[i] += v;
		buc[i/ren].insert({arr[i], i});
		i++;
	}
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = buc[i/ren].lower_bound({v-lz[i/ren], 0});
		auto ub = prev(buc[i/ren].upper_bound({v-lz[i/ren], 0}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
multiset<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].insert({arr[i], i});
	}
}

void update(int l, int r, int v) {
	int i = l;
	while (i <= r && i%ren != 0) {
		buc[i/ren].erase({arr[i], i});
		arr[i] += v;
		buc[i/ren].insert({arr[i], i});
		i++;
	}
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	while (i <= r) {
		buc[i/ren].erase({arr[i], i});
		arr[i] += v;
		buc[i/ren].insert({arr[i], i});
		i++;
	}
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = buc[i/ren].lower_bound({v-lz[i/ren], 0});
		auto ub = prev(buc[i/ren].upper_bound({v-lz[i/ren], INF}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void update(int l, int r, int v) {
	int i = l;
	while (i <= r && i%ren != 0) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		pos->a = arr[i];
		i++;
	}
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	while (i <= r) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		pos->a = arr[i];
		i++;
	}
	sort(buc[l/ren].begin(), buc[l/ren].end());
	sort(buc[r/ren].begin(), buc[r/ren].end());
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], 0});
		auto ub = upper_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], INF});
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void update(int l, int r, int v) {
	int i = l;
	vector<vector<ii>::iterator> temp;
	while (i <= r && i%ren != 0) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	while (i <= r) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	sort(buc[l/ren].begin(), buc[l/ren].end());
	sort(buc[r/ren].begin(), buc[r/ren].end());
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], 0});
		auto ub = prev(upper_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], INF}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 500005
#define MAXS 805
#define NIL (MAXN-1)
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;

int ren;
lint arr[MAXN], lz[MAXS];
vector<ii> buc[MAXS];

void init() {
	ren = sqrt(N);
	for (int i = 0; i < N; i++) {
		buc[i/ren].push_back({arr[i], i});
		if (i%ren == ren-1) sort(buc[i/ren].begin(), buc[i/ren].end());
	}
	sort(buc[(N-1)/ren].begin(), buc[(N-1)/ren].end());
}

void update(int l, int r, int v) {
	int i = l;
	vector<vector<ii>::iterator> temp;
	while (i <= r && i%ren != 0) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	while (i+ren-1 <= r) {
		lz[i/ren] += v;
		i += ren;
	}
	temp.clear();
	while (i <= r) {
		auto pos = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){arr[i], i});
		arr[i] += v;
		temp.push_back(pos);
		i++;
	}
	for (auto i: temp) i->a = arr[i->b];
	sort(buc[l/ren].begin(), buc[l/ren].end());
	sort(buc[r/ren].begin(), buc[r/ren].end());
}

void query(int v) {
	lint l = INF, r = -INF;
	lint i = 0;
	while (i < N && i%ren != 0) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	while (i+ren-1 < N) {
		auto lb = lower_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], 0});
		if (lb->a != v-lz[i/ren]) {
			i += ren;
			continue;
		}
		auto ub = prev(upper_bound(buc[i/ren].begin(), buc[i/ren].end(), (ii){v-lz[i/ren], INF}));
		if (lb->a == v-lz[i/ren]) {
			l = min(l, lb->b);
			r = max(r, lb->b);
		}
		if (ub->a == v-lz[i/ren]) {
			l = min(l, ub->b);
			r = max(r, ub->b);
		}
		i += ren;
	}
	while (i < N) {
		if (arr[i]+lz[i/ren] == v) {
			l = min(l, i);
			r = max(r, i);
		}
		i++;
	}
	if (l == INF) puts("-1");
	else printf("%lld\n", r-l);
}

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif

	scanf("%d%d", &N, &Q);
	for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
	init();
	for (int i = 0; i < Q; i++) {
		int op;
		scanf("%d", &op);
		if (op == 1) {
			scanf("%d%d%d", &x, &y, &z);
			update(x-1, y-1, z);
		}
		else {
			scanf("%d", &x);
			query(x);
		}
	}

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=981;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	if(a[cnt1].size()==1)
		return 0;

	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	if(a[cnt1].size()==1)
		return 0;

	int l=0;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1>0)
			break;

	}

	for(int i=cnt;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2>0)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int rf=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[rf]=get(ki);
			rf++;
		}
	}
	for(int i=1;i<rf;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=1200;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	int l=0;
	int r=a[cnt].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt+1;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1>0)
			break;

	}

	for(int i=cnt+1;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2>0)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=981;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	if(a[cnt1].size()==0)
		return 0;

	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	if(a[cnt1].size()==0)
		return 0;

	int l=0;
	int r=a[cnt].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1>0)
			break;

	}

	for(int i=cnt;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2>0)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=800;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt1].size()-1;

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	int l=0;
	int r=a[cnt].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt+1;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1>0)
			break;

	}

	for(int i=cnt+1;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2>0)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=800;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt+1;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1!=-1)
			break;

	}

	for(int i=cnt+1;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2!=-1)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=800;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	int l=0;
	int r=a[cnt].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt+1;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1>0)
			break;

	}

	for(int i=cnt+1;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2>0)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

int main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	cout<<endl;
	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=800;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	int l=0;
	int r=a[cnt].size()+1;

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt+1;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1>0)
			break;

	}

	for(int i=cnt+1;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2>0)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


/// ANTI_LGIHT ///

#include <bits/stdc++.h>

using namespace std;

#define int long long int

typedef pair<int,int> pii;
#define f first
#define s second;

const int maxn=5e5+100;
const int sq=800;
vector<pii>a[sq];
int ans[maxn];
int val[sq];
int b[maxn];
int cnt=1;

bool cmp(pii A,pii B)
{
	if(A.first!=B.first)
		return A.first < B.first;
	return A.second < B.second;
}

int fi(int x)
{
	int sum=0;
	int ret=1;

	while(sum<x)
	{
		sum+=a[ret].size();
		ret++;
	}
	return ret-1;
}
void add(int l,int r,int ki)
{
	int cnt1=fi(l);
	int cnt2=fi(r);

	if(cnt1==cnt2)
	{
		for(int i=0;i<a[cnt1].size();i++)
			a[cnt1][i].first+=val[cnt1];

		val[cnt1]=0;

		for(int i=0;i<a[cnt1].size();i++)
			if(a[cnt1][i].second >=l and a[cnt1][i].second <=r)
				a[cnt1][i].first+=ki;

		sort(a[cnt1].begin(),a[cnt1].end(),cmp);
		return ;
	}

	for(int i=cnt1+1;i<cnt2;i++)
		val[i]+=ki;

	for(int i=0;i<a[cnt1].size();i++)
		a[cnt1][i].first+=val[cnt1];

	for(int i=0;i<a[cnt2].size();i++)
		a[cnt2][i].first+=val[cnt2];

	val[cnt1]=0;
	val[cnt2]=0;

	for(int i=0;i<a[cnt1].size();i++)
		if(a[cnt1][i].second>=l)
			a[cnt1][i].first+=ki;

	for(int i=0;i<a[cnt2].size();i++)
		if(a[cnt2][i].second<=r)
			a[cnt2][i].first+=ki;

	sort(a[cnt1].begin(),a[cnt1].end(),cmp);
	sort(a[cnt2].begin(),a[cnt2].end(),cmp);

}

int bs1(int cnt1,int x)
{
	int l=-1;
	int r=a[cnt1].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if( x <= a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return r;
}

int bs2(int cnt1,int x)
{
	int l=0;
	int r=a[cnt].size();

	while(r-l>1)
	{
		int mid=(l+r)/2;

		if(x<a[cnt1][mid].first)
			r=mid;
		else
			l=mid;
	}
	return l;
}

int get(int x)
{
	int f1=-1;
	int f2=-1;

	for(int i=1;i<=cnt+1;i++)
	{
		if(!a[i].size())
			continue;

		int p1=bs1(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f1=a[i][p1].second;

		if(f1!=-1)
			break;

	}

	for(int i=cnt+1;i>=1;i--)
	{
		if(!a[i].size())
			continue;

		int p1=bs2(i,x-val[i]);

		if(a[i][p1].first==x-val[i])
			f2=a[i][p1].second;

		if(f2!=-1)
			break;

		if(p1==0)
			continue;

		if(a[i][p1-1].first==x-val[i])
			f2=a[i][p1-1].second;

		if(f2!=-1)
			break;
	}

	if(f1==-1 and f2==-1)
		return -1;

	if(f1==-1 or f2==-1)
		return 0;

	return f2-f1;
}

main()
{
	ios_base::sync_with_stdio(false);

	int n,q;
	cin>>n>>q;

	int h=0;
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		a[cnt].push_back(make_pair(b[i],i));
		h++;

		if(h%sq==0)
			cnt++;
	}

	for(int i=1;i<=cnt;i++)
		sort(a[i].begin(),a[i].end(),cmp);

	int kir=1;
	for(int i=1;i<=q;i++)
	{
		int typ,l,r,ki;
		cin>>typ;

		if(typ==1)
		{
			cin>>l>>r>>ki;
			add(l,r,ki);
		}
		else if(typ==2)
		{
			cin>>ki;
			ans[kir]=get(ki);
			kir++;
		}
	}
	for(int i=1;i<kir;i++)
		cout<<ans[i]<<endl;

	return 0;
}


///Chefer

#include<bits/stdc++.h>
#define int long long int
#define f first
#define s second
using namespace std;
typedef pair<int,int> pii;
const int maxn=5e5+5;
int lz[1000];
int inf=1e16;
pii a[maxn];
int n,q,s,t;
int y,t1,t2;
void fix()
{
    for(int i=s*(t1/s);i<min(s*(t1/s+1),n);i++)
    {
        a[i].f+=lz[t1/s];
        if(a[i].s>=t1&&a[i].s<=t2)
            a[i].f+=y;
    }
    lz[t1/s]=0;
    sort(a+s*(t1/s),a+min(n,s*(t1/s+1)));
    if(t1/s!=t2/s)
    {
        for(int i=s*(t2/s);i<min(s*(t2/s+1),n);i++)
        {
            a[i].f+=lz[t2/s];
            if(a[i].s<=t2)
                a[i].f+=y;
        }
        lz[t2/s]=0;
        sort(a+s*(t2/s),a+min(n,s*(t2/s+1)));
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>q;
    s=sqrt(n);
    t=n/s+((n%s)!=0);
    t--;
    for(int i=0;i<n;i++)
        cin>>a[i].f,a[i].s=i;
    for(int i=0;i<=t;i++)
        sort(a+i*s,a+min((i+1LL)*s,n));
    int tp;
    for(int T=1;T<=q;T++)
    {
        cin>>tp;
        if(tp==1)
        {
            cin>>t1>>t2>>y;
            t1--;
            t2--;
            fix();
            for(int i=t1/s+1;i<t2/s;i++)
                lz[i]+=y;
        }
        else
        {
            cin>>y;
            t1=n;
            t2=-1;
            int tmp;
            int l,r,mid;
            for(int i=0;i<=t;i++)
            {
                tmp=y-lz[i];
                l=i*s;
                r=min((i+1)*s,n);
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f<=y)
                        l=mid;
                    else
                        r=mid;
                }
                if(a[l].f==tmp)
                    t2=max(t2,a[l].s);
                l=i*s-1;
                r=(i+1)*s-1;
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f>=tmp)
                        r=mid;
                    else
                        l=mid;
                }
                if(a[r].f==tmp)
                    t1=min(t1,a[r].s);
            }
            cout<<max(t2-t1,-1LL)<<"\n";
        }
    }
}


///Chefer

#include<bits/stdc++.h>
#define int long long int
#define f first
#define s second
using namespace std;
typedef pair<int,int> pii;
const int maxn=5e5+5;
int lz[1000];
int inf=1e16;
pii a[maxn];
int n,q,s,t;
int y,t1,t2;
void fix()
{
    for(int i=s*(t1/s);i<s*(t1/s+1);i++)
    {
        a[i].f+=lz[t1/s];
        if(a[i].s>=t1&&a[i].s<=t2)
            a[i].f+=y;
    }
    lz[t1/s]=0;
    sort(a+s*(t1/s),a+min(n,s*(t1/s+1)));
    if(t1/s!=t2/s)
    {
        for(int i=s*(t2/s);i<s*(t2/s+1);i++)
        {
            a[i].f+=lz[t2/s];
            if(a[i].s<=t2)
                a[i].f+=y;
        }
        lz[t2/s]=0;
        sort(a+s*(t2/s),a+min(n,s*(t2/s+1)));
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>q;
    s=sqrt(n);
    t=n/s+((n%s)!=0);
    t--;
    for(int i=0;i<n;i++)
        cin>>a[i].f,a[i].s=i;
    for(int i=0;i<=t;i++)
        sort(a+i*s,a+min((i+1LL)*s,n));
    int tp;
    for(int T=1;T<=q;T++)
    {
        cin>>tp;
        if(tp==1)
        {
            cin>>t1>>t2>>y;
            t1--;
            t2--;
            fix();
            for(int i=t1/s+1;i<t2/s;i++)
                lz[i]+=y;
        }
        else
        {
            cin>>y;
            t1=n;
            t2=-1;
            int tmp;
            int l,r,mid;
            for(int i=0;i<=t;i++)
            {
                tmp=y-lz[i];
                l=i*s;
                r=min((i+1)*s,n);
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f<=y)
                        l=mid;
                    else
                        r=mid;
                }
                if(a[l].f==tmp)
                    t2=max(t2,l);
                l=i*s-1;
                r=(i+1)*s-1;
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f>=tmp)
                        r=mid;
                    else
                        l=mid;
                }
                if(a[r].f==tmp)
                    t1=min(t1,r);
            }
            cout<<max(t2-t1,-1LL)<<"\n";
        }
    }
}


///Chefer

#include<bits/stdc++.h>
#define int long long int
#define f first
#define s second
using namespace std;
typedef pair<int,int> pii;
const int maxn=5e5+5;
int lz[1000];
int inf=1e16;
pii a[maxn];
int n,q,s,t;
int y,t1,t2;
void fix()
{
    for(int i=s*(t1/s);i<s*(t1/s+1);i++)
    {
        a[i].f+=lz[t1/s];
        if(a[i].s>=t1&&a[i].s<=t2)
            a[i].f+=y;
    }
    lz[t1/s]=0;
    sort(a+s*(t1/s),a+min(n,s*(t1/s+1)));
    if(t1/s!=t2/s)
    {
        for(int i=s*(t2/s);i<s*(t2/s+1);i++)
        {
            a[i].f+=lz[t2/s];
            if(a[i].s<=t2)
                a[i].f+=y;
        }
        lz[t2/s]=0;
        sort(a+s*(t2/s),a+min(n,s*(t2/s+1)));
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>q;
    s=sqrt(n);
    t=n/s+((n%s)!=0);
    t--;
    for(int i=0;i<n;i++)
        cin>>a[i].f,a[i].s=i;
    for(int i=0;i<=t;i++)
        sort(a+i*s,a+min((i+1LL)*s,n));
    int tp;
    for(int T=1;T<=q;T++)
    {
        cin>>tp;
        if(tp==1)
        {
            cin>>t1>>t2>>y;
            t1--;
            t2--;
            fix();
            for(int i=t1/s+1;i<t2/s;i++)
                lz[i]+=y;
        }
        else
        {
            cin>>y;
            t1=n;
            t2=-1;
            int tmp;
            int l,r,mid;
            for(int i=0;i<=t;i++)
            {
                tmp=y-lz[i];
                l=i*s;
                r=min((i+1)*s,n);
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f<=y)
                        l=mid;
                    else
                        r=mid;
                }
                if(a[l].f==tmp)
                    t2=max(t2,a[l].s);
                l=i*s-1;
                r=(i+1)*s-1;
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f>=tmp)
                        r=mid;
                    else
                        l=mid;
                }
                if(a[r].f==tmp)
                    t1=min(t1,a[r].s);
            }
            cout<<max(t2-t1,-1LL)<<"\n";
        }
    }
}


///Chefer

#include<bits/stdc++.h>
#define int long long int
#define f first
#define s second
using namespace std;
typedef pair<int,int> pii;
const int maxn=5e5+5;
int lz[1000];
int inf=1e16;
pii a[maxn];
int n,q,s,t;
int y,t1,t2;
void fix()
{
    for(int i=s*(t1/s);i<min(s*(t1/s+1),n);i++)
    {
        a[i].f+=lz[t1/s];
        if(a[i].s>=t1&&a[i].s<=t2)
            a[i].f+=y;
    }
    lz[t1/s]=0;
    sort(a+s*(t1/s),a+min(n,s*(t1/s+1)));
    if(t1/s!=t2/s)
    {
        for(int i=s*(t2/s);i<min(s*(t2/s+1),n);i++)
        {
            a[i].f+=lz[t2/s];
            if(a[i].s<=t2)
                a[i].f+=y;
        }
        lz[t2/s]=0;
        sort(a+s*(t2/s),a+min(n,s*(t2/s+1)));
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>q;
    s=sqrt(n);
    t=n/s+((n%s)!=0);
    t--;
    for(int i=0;i<n;i++)
        cin>>a[i].f,a[i].s=i;
    for(int i=0;i<=t;i++)
        sort(a+i*s,a+min((i+1LL)*s,n));
    int tp;
    for(int T=1;T<=q;T++)
    {
        cin>>tp;
        if(tp==1)
        {
            cin>>t1>>t2>>y;
            t1--;
            t2--;
            fix();
            for(int i=t1/s+1;i<t2/s;i++)
                lz[i]+=y;
        }
        else
        {
            cin>>y;
            t1=n;
            t2=-1;
            int tmp;
            int l,r,mid;
            for(int i=0;i<=t;i++)
            {
                tmp=y-lz[i];
                l=i*s;
                r=min((i+1)*s,n);
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f<=y)
                        l=mid;
                    else
                        r=mid;
                }
                if(a[l].f==tmp)
                    t2=max(t2,a[l].s);
                l=i*s-1;
                r=min((i+1)*s,n)-1;
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f>=tmp)
                        r=mid;
                    else
                        l=mid;
                }
                if(a[r].f==tmp)
                    t1=min(t1,a[r].s);
            }
            cout<<max(t2-t1,-1LL)<<"\n";
        }
    }
}


///Chefer

#include<bits/stdc++.h>
#define int long long int
#define f first
#define s second
using namespace std;
typedef pair<int,int> pii;
const int maxn=5e5+5;
int lz[1000];
int inf=1e16;
pii a[maxn];
int n,q,s,t;
int y,t1,t2;
void fix()
{
    for(int i=s*(t1/s);i<min(s*(t1/s+1),n);i++)
    {
        a[i].f+=lz[t1/s];
        if(a[i].s>=t1&&a[i].s<=t2)
            a[i].f+=y;
    }
    lz[t1/s]=0;
    sort(a+s*(t1/s),a+min(n,s*(t1/s+1)));
    if(t1/s!=t2/s)
    {
        for(int i=s*(t2/s);i<min(s*(t2/s+1),n);i++)
        {
            a[i].f+=lz[t2/s];
            if(a[i].s<=t2)
                a[i].f+=y;
        }
        lz[t2/s]=0;
        sort(a+s*(t2/s),a+min(n,s*(t2/s+1)));
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>q;
    s=sqrt(n);
    t=n/s+((n%s)!=0);
    t--;
    for(int i=0;i<n;i++)
        cin>>a[i].f,a[i].s=i;
    for(int i=0;i<=t;i++)
        sort(a+i*s,a+min((i+1LL)*s,n));
    int tp;
    for(int T=1;T<=q;T++)
    {
        cin>>tp;
        if(tp==1)
        {
            cin>>t1>>t2>>y;
            t1--;
            t2--;
            fix();
            for(int i=t1/s+1;i<t2/s;i++)
                lz[i]+=y;
        }
        else
        {
            int x;
            cin>>x;
            t1=n;
            t2=-1;
            int tmp;
            int l,r,mid;
            for(int i=0;i<=t;i++)
            {
                tmp=x-lz[i];
                l=i*s;
                r=min((i+1)*s,n);
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f<=y)
                        l=mid;
                    else
                        r=mid;
                }
                if(a[l].f==tmp)
                    t2=max(t2,a[l].s);
                l=i*s-1;
                r=min((i+1)*s,n)-1;
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f>=tmp)
                        r=mid;
                    else
                        l=mid;
                }
                if(a[r].f==tmp)
                    t1=min(t1,a[r].s);
            }
            cout<<max(t2-t1,-1LL)<<"\n";
        }
    }
}


///Chefer

#include<bits/stdc++.h>
#define int long long int
#define f first
#define s second
using namespace std;
typedef pair<int,int> pii;
const int maxn=5e5+5;
int lz[1000];
int inf=1e16;
pii a[maxn];
int n,q,s,t;
int y,t1,t2;
void fix()
{
    for(int i=s*(t1/s);i<min(s*(t1/s+1),n);i++)
    {
        a[i].f+=lz[t1/s];
        if(a[i].s>=t1&&a[i].s<=t2)
            a[i].f+=y;
    }
    lz[t1/s]=0;
    sort(a+s*(t1/s),a+min(n,s*(t1/s+1)));
    if(t1/s!=t2/s)
    {
        for(int i=s*(t2/s);i<min(s*(t2/s+1),n);i++)
        {
            a[i].f+=lz[t2/s];
            if(a[i].s<=t2)
                a[i].f+=y;
        }
        lz[t2/s]=0;
        sort(a+s*(t2/s),a+min(n,s*(t2/s+1)));
    }
}
main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>q;
    s=sqrt(n);
    t=n/s+((n%s)!=0);
    t--;
    for(int i=0;i<n;i++)
        cin>>a[i].f,a[i].s=i;
    for(int i=0;i<=t;i++)
        sort(a+i*s,a+min((i+1LL)*s,n));
    int tp;
    for(int T=1;T<=q;T++)
    {
        cin>>tp;
        if(tp==1)
        {
            cin>>t1>>t2>>y;
            t1--;
            t2--;
            fix();
            for(int i=t1/s+1;i<t2/s;i++)
                lz[i]+=y;
        }
        else
        {
            cin>>y;
            t1=n;
            t2=-1;
            int tmp;
            int l,r,mid;
            for(int i=0;i<=t;i++)
            {
                tmp=y-lz[i];
                l=i*s;
                r=min((i+1)*s,n);
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f<=tmp)
                        l=mid;
                    else
                        r=mid;
                }
                if(a[l].f==tmp)
                    t2=max(t2,a[l].s);
                l=i*s-1;
                r=min((i+1)*s,n)-1;
                while(l+1!=r)
                {
                    mid=(l+r)/2;
                    if(a[mid].f>=tmp)
                        r=mid;
                    else
                        l=mid;
                }
                if(a[r].f==tmp)
                    t1=min(t1,a[r].s);
            }
            cout<<max(t2-t1,-1LL)<<"\n";
        }
    }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%d",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = l/SQ + 1; id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int x){
    int mn = N, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        int y = x - lazy[ i/SQ ];
        int l = lower_bound(a+i,a+min(n,i+SQ),pii(y,-1)) - a;
        if( a[ l ].first == y ) mn = min( mn, a[l].second);
        l = upper_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l >= i && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 || mn == N) printf("-1 ");
    else printf("%d ",mx-mn);
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%d",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = ceil(1.0*l/SQ); id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int y){
    int mn = 1e9, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        pii cur = *lower_bound(a+i,a+min(n,i+SQ),pii(y,-1));
        if( cur.first == y ) mn = min( mn, cur.second);
        int l = upper_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l != -1 && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 ) printf("-1 ");
    else printf("%d ",mx-mn);
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%d",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = l/SQ + 1; id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int x){
    int mn = 1e9, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        int y = x - lazy[ i/SQ ];
        int l = lower_bound(a+i,a+min(n,i+SQ),pii(y,-1)) - a;
        if( a[ l ].first == y ) mn = min( mn, a[l].second);
        l = upper_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l >= i && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 ) printf("-1 ");
    else printf("%d ",mx-mn);
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%lld",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = l/SQ + 1; id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int x){
    int mn = 1e9, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        int y = x - lazy[ i/SQ ];
        int l = lower_bound(a+i,a+min(n,i+SQ),pii(y,-1)) - a;
        if( l < min( n, i + SQ ) && a[ l ].first == y ) mn = min( mn, a[l].second);
        l = lower_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l >= i && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 ) printf("-1 ");
    else printf("%lld ",mx-mn);
    return;
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%d",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = l/SQ + 1; id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int x){
    int mn = 1e9, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        int y = x - lazy[ i/SQ ];
        int l = lower_bound(a+i,a+min(n,i+SQ),pii(y,-1)) - a;
        if( l < min( n, i + SQ ) && a[ l ].first == y ) mn = min( mn, a[l].second);
        l = lower_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l >= i && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 ) printf("-1 ");
    else printf("%d ",mx-mn);
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%d",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = ceil(1.0*l/SQ); id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int x){
    int mn = 1e9, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        int y = x - lazy[ i/SQ ];
        pii cur = *lower_bound(a+i,a+min(n,i+SQ),pii(y,-1));
        if( cur.first == y ) mn = min( mn, cur.second);
        int l = upper_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l != -1 && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 ) printf("-1 ");
    else printf("%d ",mx-mn);
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


                        // ALLAH \\
                who is Hussain? -> whoishussain.org
#include<bits/stdc++.h>
using namespace std;
const int N = 5 * 1e5 + 100;
const int SQ = 650;
typedef pair<int,int> pii;
int n, m, lazy[ N ];
pii a[ N ];
int in(){ int x; scanf("%d",&x); return x; }
void relax(int id){ sort( a + id*SQ, a + min((id+1)*SQ,n) ); }
void upd(int l, int r, int x){
   for(int id = ceil(1.0*l/SQ); id < r/SQ; id++)
       lazy[ id ] += x;
   int st[ 2 ] = { l-l%SQ, r - r%SQ };
   for(int t = 0; t < 1 + (st[ 0 ]!=st[ 1 ]); t++ ) {
        for(int i = 0; i < SQ; i++)
            if( a[ i + st[ t ] ].second >= l && a[ i + st[ t ] ].second < r )
               a[ i + st[ t ] ].first += x;
        relax( st[ t ]/SQ );
   }
}
void get(int x){
    int mn = 1e9, mx = -1;
    for(int i = 0;i  < n; i+=SQ){
        int y = x - lazy[ i/SQ ];
        int l = lower_bound(a+i,a+min(n,i+SQ),pii(y,-1)) - a;
        if( a[ l ].first == y ) mn = min( mn, a[l].second);
        l = upper_bound( a+i, a+min(n,i+SQ), pii(y+1,-1))-1-a;
        if( l >= i && a[ l ].first == y ) mx = max( mx, a[ l ].second);
    }
    if( mx == -1 ) printf("-1 ");
    else printf("%d ",mx-mn);
}
void build(){
   for(int i = 0;i < n; i+=SQ)
       relax( i/SQ );
}
main(){
   n = in(), m = in() ;
   for(int i = 0;i < n;i ++)
       a[ i ] = pii(in(), i);

   build();

   while( m-- ){
       int t = in(), l = in();
       if( t == 1 ){
           int r = in(), x = in();
           upd(l-1, r, x);
       }
       else get(l);
   }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 1024;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<unordered_map<ll, vector<int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B][a[i]].push_back(i);
    }
    while(q--) {
        int com; scanf("%d", &com);
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    pos[b].clear();
                    for(int i = l2; i < r2; ++i) {
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b][a[i]].push_back(i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                if(pos[b].count(y - lazy_add[b]) == 0) continue;
                if(pos[b][y - lazy_add[b]].empty()) continue;
                l = min(l, *begin(pos[b][y - lazy_add[b]]));
                r = max(r, *(end(pos[b][y - lazy_add[b]]) - 1));
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 512;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<unordered_map<ll, vector<int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B][a[i]].push_back(i);
    }
    while(q--) {
        int com; scanf("%d", &com);
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    pos[b].clear();
                    for(int i = l2; i < r2; ++i) {
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b][a[i]].push_back(i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                if(pos[b].count(y - lazy_add[b]) == 0) continue;
                if(pos[b][y - lazy_add[b]].empty()) continue;
                l = min(l, *begin(pos[b][y - lazy_add[b]]));
                r = max(r, *(end(pos[b][y - lazy_add[b]]) - 1));
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 512;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<vector<pair<ll, int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B].emplace_back(a[i], i);
    }
    for(auto& v : pos) {
        sort(begin(v), end(v));
    }
    auto get_range = [&] (vector<pair<ll, int>> const& vs, ll val) {
        auto lb = lower_bound(begin(vs), end(vs), make_pair(val, -1));
        if(lb == end(vs) || lb->first != val) return make_pair(n, 0);
        auto ub = lower_bound(begin(vs), end(vs), make_pair(val + 1, -1));
        return make_pair(lb->second, prev(ub)->second);
    };
    while(q--) {
        int com; scanf("%d", &com);
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    pos[b].clear();
                    for(int i = l2; i < r2; ++i) {
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b].emplace_back(a[i], i);
                    }
                    lazy_add[b] = 0;
                    sort(begin(pos[b]), end(pos[b]));
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                auto p = get_range(pos[b], y - lazy_add[b]);
                l = min(l, p.first), r = max(r, p.second);
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 1024;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<unordered_map<ll, set<int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B][a[i]].insert(i);
    }
    while(q--) {
        int com; cin >> com;
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    pos[b].clear();
                    for(int i = l2; i < r2; ++i) {
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b][a[i]].insert(i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                if(pos[b].count(y - lazy_add[b]) == 0) continue;
                if(pos[b][y - lazy_add[b]].empty()) continue;
                l = min(l, *begin(pos[b][y - lazy_add[b]]));
                r = max(r, *prev(end(pos[b][y - lazy_add[b]])));
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 1024;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<unordered_map<ll, set<int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B][a[i]].insert(i);
    }
    while(q--) {
        int com; cin >> com;
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    for(int i = l2; i < r2; ++i) {
                        pos[b][a[i]].erase(i);
                        if(pos[b][a[i]].empty()) pos[b].erase(a[i]);
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b][a[i]].insert(i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                if(pos[b].count(y - lazy_add[b]) == 0) continue;
                if(pos[b][y - lazy_add[b]].empty()) continue;
                l = min(l, *begin(pos[b][y - lazy_add[b]]));
                r = max(r, *prev(end(pos[b][y - lazy_add[b]])));
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 512;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<vector<pair<ll, int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B].emplace_back(a[i], i);
    }
    auto get_range = [&] (vector<pair<ll, int>> const& vs, ll val) {
        auto lb = lower_bound(begin(vs), end(vs), make_pair(val, -1));
        if(lb == end(vs) || lb->first != val) return make_pair(n, 0);
        auto ub = lower_bound(begin(vs), end(vs), make_pair(val + 1, -1));
        return make_pair(lb->second, prev(ub)->second);
    };
    while(q--) {
        int com; scanf("%d", &com);
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    pos[b].clear();
                    for(int i = l2; i < r2; ++i) {
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b].emplace_back(a[i], i);
                    }
                    lazy_add[b] = 0;
                    sort(begin(pos[b]), end(pos[b]));
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                auto p = get_range(pos[b], y - lazy_add[b]);
                l = min(l, p.first), r = max(r, p.second);
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    constexpr int B = 1024;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<map<ll, set<int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B][a[i]].insert(i);
    }
    while(q--) {
        int com; cin >> com;
        if(com == 1) {
            int l, r, x;
            cin >> l >> r >> x;
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    for(int i = l2; i < r2; ++i) {
                        pos[b][a[i]].erase(i);
                        if(pos[b][a[i]].empty()) pos[b].erase(a[i]);
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b][a[i]].insert(i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; cin >> y;
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                if(pos[b].count(y - lazy_add[b]) == 0) continue;
                if(pos[b][y - lazy_add[b]].empty()) continue;
                l = min(l, *begin(pos[b][y - lazy_add[b]]));
                r = max(r, *prev(end(pos[b][y - lazy_add[b]])));
            }
            cout << max(-1, r - l) << endl;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    constexpr int B = 512;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<vector<pair<ll, int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B].emplace_back(a[i], i);
    }
    auto get_range = [&] (vector<pair<ll, int>> const& vs, ll val) {
        auto lb = lower_bound(begin(vs), end(vs), make_pair(val, -1));
        if(lb == end(vs) || lb->first != val) return make_pair(n, 0);
        auto ub = lower_bound(begin(vs), end(vs), make_pair(val + 1, -1));
        return make_pair(lb->second, prev(ub)->second);
    };
    while(q--) {
        int com; scanf("%d", &com);
        if(com == 1) {
            int l, r, x;
            scanf("%d %d %d", &l, &r, &x);
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    pos[b].clear();
                    for(int i = l2; i < r2; ++i) {
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b].emplace_back(a[i], i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; scanf("%d", &y);
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                sort(begin(pos[b]), end(pos[b]));
                auto p = get_range(pos[b], y - lazy_add[b]);
                l = min(l, p.first), r = max(r, p.second);
            }
            printf("%d\n", max(-1, r - l));
        }
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    constexpr int B = 1024;
    vector<ll> lazy_add((n + B - 1) / B);
    const int b_sz = lazy_add.size();
    vector<map<ll, set<int>>> pos(b_sz);
    for(int i = 0; i < n; ++i) {
        pos[i / B][a[i]].insert(i);
    }
    while(q--) {
        int com; cin >> com;
        if(com == 1) {
            int l, r, x;
            cin >> l >> r >> x;
            l--;
            for(int b = 0; b < b_sz; ++b) {
                const int l2 = b * B, r2 = min(n, (b + 1) * B);
                if(r <= l2 || r2 <= l) continue;
                if(l <= l2 && r2 <= r) {
                    lazy_add[b] += x;
                } else {
                    for(int i = l2; i < r2; ++i) {
                        pos[b][a[i]].erase(i);
                        a[i] += lazy_add[b];
                        if(l <= i && i < r) {
                            a[i] += x;
                        }
                        pos[b][a[i]].insert(i);
                    }
                    lazy_add[b] = 0;
                }
            }
        } else {
            int y; cin >> y;
            int l = n, r = 0;
            for(int b = 0; b < b_sz; ++b) {
                if(pos[b].count(y - lazy_add[b]) == 0) continue;
                if(pos[b][y - lazy_add[b]].empty()) continue;
                l = min(l, *begin(pos[b][y - lazy_add[b]]));
                r = max(r, *prev(end(pos[b][y - lazy_add[b]])));
            }
            cout << max(-1, r - l) << endl;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 //   freopen("input.txt", "r", stdin);
 //   freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
sss =   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
unordered_set<int> s[910];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
if (n>3)sss =   int(sqrt(n))-1;
else sss=int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if (n>1000)sss=int(sqrt(n))*10;
	if(n>2 && n < 100)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
multiset<int> s[910];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 //  freopen("input.txt", "r", stdin);
 //   freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
if (n>3)sss =   int(sqrt(n))-1;
else sss=int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
unordered_set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  //  freopen("input.txt", "r", stdin);
 //   freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
if (n>3)sss =   int(sqrt(n))-1;
else sss=int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N = 1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	sss =  int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 //   freopen("input.txt", "r", stdin);
 //   freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	sss =   int(sqrt(n))-1;
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  //  freopen("input.txt", "r", stdin);
 //   freopen("output.txt", "w", stdout);
	int j = 0;
	sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define F first
#define S second
const int N =1e9;
int n, q, sss;
int a[500005],ss[710];
set<int> s[710];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   // freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
	int j = 0;
	cin >> n >> q;
	if(n>2 && n < 100)sss =   int(sqrt(n))-1;
	else sss=   int(sqrt(n));
	for(int i=0; i<n; ++i)
	{
		cin >> a[i];
		if(i && i%sss == 0) ++j;
		s[j].insert(a[i]);
	}

	for(int i=0; i<q; ++i)
	{
		int f, l, r, x;
		cin >>f;
		if(f == 1)
 		{
			cin >> l >> r >> x;
			r--;l--;
        for(int i=l; i<=r; ++i)
		if(i%sss == 0 && i+sss-1<=r)
		{
			ss[i/sss] += x;
			if(ss[i/sss] > N)ss[i/sss] = N+1;
			i+=sss-1;
		}
		else
		{
			s[i/sss].erase(s[i/sss].find(a[i]));
			a[i] = a[i] + x;
			if(a[i] > N) a[i] = N+1;
			s[i/sss].insert(a[i]);
		}

		}
		else
		{
			int Y;
			cin >> Y;
			int l = -1, r = -2;
	for(int i=0; i<n; ++i)
	{

		if(a[i] +ss[i/sss] == Y)
		{
			l = i;
			break;
		}
		if(i%sss == 0 && i+sss<=n)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i += sss-1;
		}
	}
	for(int i=n-1; i>=0; --i)
	{
		if(a[i] +ss[i/sss] == Y)
		{
			r = i;
			break;
		}
		if((i+1)%sss == 0)
		{
			if(s[i/sss].find(Y-ss[i/sss]) == s[i/sss].end())
				i = i - sss + 1;
		}
	}
	cout << r-l << endl;
		}
	}
}