#include <bits/stdc++.h>
using namespace std;
int n;
const int b = 2500;
long long a[500005];
long long delta[220];
bool old[220];
vector<int> q;
unordered_map<long long, int> mx[220];
unordered_map<long long, int> mi[220];
void calc(int id) {
  mx[id].clear();
  mi[id].clear();
  for (int i = min((id + 1) * b - 1, n - 1); i >= id * b; i--) {
    if (mx[id].find(a[i]) == mx[id].end()) {
      mx[id][a[i]] = i;
    }
  }
  for (int i = id * b; i <= min((id + 1) * b - 1, n - 1); i++) {
    if (mi[id].find(a[i]) == mi[id].end()) {
      mi[id][a[i]] = i;
    }
  }
}
void addTask(int x) {
  if (q.size() < 300) {
    q.push_back(x);
  }
  old[x] = true;
}
void doTask() {
  if (q.size() > 280) {
    for (int i = 0; i * b < n; i++) {
      if (old[i]) {
        calc(i);
        old[i] = false;
      }
    }
  } else {
    for (int i = 0; i < q.size(); i++) {
      if (old[q[i]]) {
        calc(q[i]);
        old[q[i]] = false;
      }
    }
  }
  q.clear();
}
int main() {
  ios_base::sync_with_stdio(false);
  int Q;
  scanf("%d%d", &n, &Q);
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
  }
  for (int i = 0; i * b < n; i++) {
    addTask(i);
  }
  for (int QQ = 0; QQ < Q; QQ++) {
    int typ;
    scanf("%d", &typ);
    if (typ == 1) {
      int l, r;
      long long x;
      scanf("%d%d%lld", &l, &r, &x);
      l--;
      r--;
      if (l / b == r / b) {
        for (int i = l; i <= r; i++) {
          a[i] += x;
        }
        calc(l / b);
      } else {
        int lb, rb;
        if (l % b) {
          lb = l / b + 1;
          for (int i = l; i < n && i <= (l / b + 1) * b - 1; i++) {
            a[i] += x;
          }
          addTask(l / b);
        } else {
          lb = l / b;
        }
        if ((r + 1) % b) {
          rb = r / b - 1;
          for (int i = r / b * b; i <= r; i++) {
            a[i] += x;
          }
          addTask(r / b);
        } else {
          rb = r / b;
        }
        for (int i = lb; i <= rb; i++) {
          delta[i] += x;
        }
      }
    } else {
      doTask();
      long long y;
      scanf("%lld", &y);
      int mini = 1000000007;
      int maxi = -1;
      for (int i = 0; i * b <= n; i++) {
        if (mi[i].find(y - delta[i]) == mi[i].end()) continue;
        mini = min(mini, mi[i][y - delta[i]]);
      }
      for (int i = 0; i * b <= n; i++) {
        if (mx[i].find(y - delta[i]) == mx[i].end()) continue;
        maxi = max(maxi, mx[i][y - delta[i]]);
      }
      if (mini == 1000000007 || maxi == -1) {
        cout << -1 << endl;
      } else {
        cout << maxi - mini << endl;
      }
    }
  }
  return 0;
}
