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

const int MAXN = 1e5 + 5;
const int BLOCK = 320;

int n, q;
int a[MAXN], lazy[BLOCK], belong[MAXN], S, so_block;
vector<pair<int, int>> block[BLOCK];

void rebuild(int b) {
    block[b].clear();
    int l = b * S;
    int r = min(n, (b + 1) * S - 1);
    for (int i = l; i <= r; ++i)
        block[b].emplace_back(a[i], i);
    sort(block[b].begin(), block[b].end());
}

void update(int l, int r, int x) {
    int bl = belong[l], br = belong[r];
    if (bl == br) {
        for (int i = l; i <= r; ++i) a[i] += x;
        rebuild(bl);
    } else {
        for (int i = l; i <= (bl + 1) * S - 1; ++i) a[i] += x;
        for (int i = br * S; i <= r; ++i) a[i] += x;
        rebuild(bl);
        rebuild(br);
        for (int b = bl + 1; b < br; ++b)
            lazy[b] += x;
    }
}

int query(int x) {
    int trai = n + 1, phai = -1;
    for (int b = 0; b < so_block; ++b) {
        int val = x - lazy[b];
        auto &v = block[b];
        auto it = lower_bound(v.begin(), v.end(), make_pair(val, -1));
        while (it != v.end() && it->first == val) {
            trai = min(trai, it->second);
            phai = max(phai, it->second);
            ++it;
        }
    }
    if (phai == -1) return -1;
    return phai - trai;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> q;
    S = sqrt(n) + 1;
    so_block = (n + S - 1) / S;

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        belong[i] = i / S;
    }
    for (int b = 0; b < so_block; ++b)
        rebuild(b);

    while (q--) {
        int type;
        cin >> type;
        if (type == 1) {
            int l, r, x;
            cin >> l >> r >> x;
            --l; --r;
            update(l, r, x);
        } else {
            int x;
            cin >> x;
            cout << query(x) << '\n';
        }
    }
}