#include <bits/stdc++.h>
using namespace std;
long long add[555555];
int Block, n;
vector<pair<long long, int> > num[555555];
bool cmp(pair<long long, int> a, pair<long long, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
bool cmp2(const pair<long long, int> &p, const int v) { return p.first < v; }
bool cmp3(const int v, const pair<long long, int> &p) { return p.first < v; }
void update(int l, int r, int d) {
  int x = l / Block, y = r / Block;
  if (x == y) {
    for (int i = 0; i < num[x].size(); i++) {
      if (num[x][i].second >= l && num[x][i].second <= r)
        num[x][i].first += (d + add[x]);
      else
        num[x][i].first += add[x];
    }
    add[x] = 0;
    sort(num[x].begin(), num[x].end(), cmp);
  } else {
    for (int i = 0; i < Block; i++) {
      if (num[x][i].second >= l)
        num[x][i].first += (d + add[x]);
      else
        num[x][i].first += add[x];
    }
    add[x] = 0;
    sort(num[x].begin(), num[x].end(), cmp);
    for (int i = 0; i < num[y].size(); i++) {
      if (num[y][i].second <= r)
        num[y][i].first += (d + add[y]);
      else
        num[y][i].first += add[y];
    }
    add[y] = 0;
    sort(num[y].begin(), num[y].end(), cmp);
    for (int i = x + 1; i <= y - 1; i++) add[i] += d;
  }
}
int query(long long s) {
  int x = 0, y = (n - 1) / Block, ll, rr;
  ll = n, rr = -1;
  if (x == y) {
    for (int i = 0; i < num[0].size(); i++) {
      ll = min(ll, num[x][i].first + add[x] == s ? num[x][i].second : n);
      rr = max(rr, num[x][i].first + add[x] == s ? num[x][i].second : -1);
    }
  } else {
    for (int i = 0; i < Block; i++) {
      ll = min(ll, num[x][i].first + add[x] == s ? num[x][i].second : n);
      rr = max(rr, num[x][i].first + add[x] == s ? num[x][i].second : -1);
    }
    for (int i = 0; i < num[y].size(); i++) {
      ll = min(ll, num[y][i].first + add[y] == s ? num[y][i].second : n);
      rr = max(rr, num[y][i].first + add[y] == s ? num[y][i].second : -1);
    }
    for (int i = x + 1; i <= y - 1; i++) {
      if (add[i] > s) continue;
      int pos =
          lower_bound(num[i].begin(), num[i].end(), make_pair(s - add[i], 0)) -
          num[i].begin();
      if (pos < num[i].size() && num[i][pos].first + add[i] == s) {
        ll = min(ll, num[i][pos].second);
        rr = max(rr, num[i][pos].second);
      }
      pos = upper_bound(num[i].begin(), num[i].end(),
                        make_pair(s - add[i], 0x3f3f3f3f)) -
            num[i].begin();
      pos--;
      if (pos >= 0 && num[i][pos].first + add[i] == s) {
        ll = min(ll, num[i][pos].second);
        rr = max(rr, num[i][pos].second);
      }
    }
  }
  if (ll == n || rr == -1) return -1;
  return rr - ll;
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  Block = 800;
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    num[i / Block].push_back(make_pair(x, i));
  }
  for (int i = 0; i <= (n - 1) / Block; i++)
    sort(num[i].begin(), num[i].end(), cmp);
  while (q--) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      l--, r--;
      if (l > r) swap(l, r);
      update(l, r, x);
    } else {
      long long x;
      scanf("%lld", &x);
      printf("%d\n", query(x));
    }
  }
  return 0;
}
