#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n, q, t = 800, a[500010], add[1000], x, y, z;
map<int, int> mp[1000];
inline int readint() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
inline void outint(int a) {
  if (a >= 10) outint(a / 10);
  putchar(a % 10 + '0');
}
inline void upd(int x, int lb, int ub, int val) {
  for (int i = lb; i <= ub; i++) {
    if (val == -1) {
      mp[x][a[i]]++;
      continue;
    }
    mp[x][a[i]]--;
    if (mp[x][a[i]] == 0) mp[x].erase(mp[x].find(a[i]));
    a[i] = min(a[i] + val, (int)1e9 + 10);
    mp[x][a[i]]++;
  }
}
int main() {
  cin >> n >> q;
  for (int i = 0; i < n; i++) a[i] = readint();
  for (int i = 0; i < (n - 1) / t + 1; i++)
    upd(i, i * t, min(n, (i + 1) * t) - 1, -1);
  for (int qn = 0; qn < q; qn++) {
    x = readint();
    if (x == 1) {
      x = readint();
      y = readint();
      z = readint();
      x--;
      y--;
      int lnum = x / t, rnum = y / t;
      if (lnum == rnum)
        upd(lnum, x, y, z);
      else {
        upd(lnum, x, min(n, (lnum + 1) * t) - 1, z);
        upd(rnum, rnum * t, y, z);
        for (int i = lnum + 1; i < rnum; i++)
          add[i] = min(add[i] + z, (int)1e9 + 10);
      }
    } else {
      x = readint();
      int ans = 0, ans2 = -1, lnum = -1, rnum;
      for (int i = 0; i < (n - 1) / t + 1; i++) {
        if (mp[i].find(x - add[i]) != mp[i].end()) {
          lnum = i;
          break;
        }
      }
      if (lnum == -1) {
        puts("-1");
        continue;
      }
      for (int i = (n - 1) / t; i >= 0; i--) {
        if (mp[i].find(x - add[i]) != mp[i].end()) {
          rnum = i;
          break;
        }
      }
      for (int i = lnum * t; i < min(n, (lnum + 1) * t); i++) {
        if (a[i] == x - add[lnum]) {
          ans = i;
          break;
        }
      }
      for (int i = min(n, (rnum + 1) * t) - 1; i >= rnum * t; i--) {
        if (a[i] == x - add[rnum]) {
          ans2 = i;
          break;
        }
      }
      outint(ans2 - ans);
      printf("\n");
    }
  }
  return 0;
}
