#include <bits/stdc++.h>
using namespace std;
int read() {
  int out = 0;
  char c;
  while (!isdigit(c = getchar()))
    ;
  for (; isdigit(c); c = getchar()) out = out * 10 + c - '0';
  return out;
}
const int INF = 1e9 + 1;
const int B = 1234;
int n, m;
vector<long long> a, tag;
vector<vector<pair<long long, int> > > s;
vector<int> bl, bll, blr;
int main() {
  n = read();
  m = read();
  a.resize(n + 1);
  for (int i = 1; i <= n; ++i) a[i] = read();
  bl.resize(n + 1);
  for (int i = 0, l = 1, r; l <= n; l = r + 1, ++i) {
    r = min(n, l + B - 1);
    bll.push_back(l);
    blr.push_back(r);
    tag.push_back(0);
    s.push_back(vector<pair<long long, int> >());
    for (int j = l; j <= r; ++j) {
      bl[j] = i;
      s.back().push_back(pair<long long, int>(a[j], j));
    }
    sort(s.back().begin(), s.back().end());
  }
  while (m--) {
    if (read() == 1) {
      int l = read();
      int r = read();
      int x = read();
      s[bl[l]].clear();
      for (int i = bll[bl[l]]; i <= blr[bl[l]]; ++i) {
        a[i] += tag[bl[l]] + (i >= l && i <= r ? x : 0);
        s[bl[l]].push_back(pair<long long, int>(a[i], i));
      }
      sort(s[bl[l]].begin(), s[bl[l]].end());
      tag[bl[l]] = 0;
      if (bl[l] == bl[r]) continue;
      s[bl[r]].clear();
      for (int i = bll[bl[r]]; i <= blr[bl[r]]; ++i) {
        a[i] += tag[bl[r]] + (i >= l && i <= r ? x : 0);
        s[bl[r]].push_back(pair<long long, int>(a[i], i));
      }
      sort(s[bl[r]].begin(), s[bl[r]].end());
      tag[bl[r]] = 0;
      for (int i = bl[l] + 1; i < bl[r]; ++i) tag[i] += x;
    } else {
      int x = read();
      int l = n + 1, r = -1;
      for (int i = 0; i <= bl[n]; ++i) {
        auto k = lower_bound(s[i].begin(), s[i].end(),
                             pair<long long, int>(x - tag[i], 0));
        if (k != s[i].end() && k->first == x - tag[i]) {
          l = min(l, i);
          r = max(r, i);
        }
      }
      if (r == -1)
        puts("-1");
      else
        printf("%d\n",
               prev(lower_bound(s[r].begin(), s[r].end(),
                                pair<long long, int>(x - tag[r], n + 1)))
                       ->second -
                   lower_bound(s[l].begin(), s[l].end(),
                               pair<long long, int>(x - tag[l], 0))
                       ->second);
    }
  }
  return 0;
}
