#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long infll = 0x3f3f3f3f3f3f3f3fLL;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, q, m, block;
long long a[1000001], b[1000001], pos[1000001], add[1000001];
void reset(long long x) {
  long long l = (x - 1) * block + 1, r = min(x * block, n);
  for (long long i = l; i <= r; i++) b[i] = a[i];
  sort(b + l, b + r + 1);
}
long long find(long long x, long long v) {
  long long l = (x - 1) * block + 1, r = min(x * block, n);
  long long last = r;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (b[mid] < v)
      l = mid + 1;
    else
      r = mid;
    if (b[mid] == v) return 1;
  }
  if (b[l] == v || b[r] == v) return 1;
  return 0;
}
void update(long long x, long long y, long long v) {
  if (pos[x] == pos[y]) {
    for (int i = x; i <= y; i++) a[i] = a[i] + v;
  } else {
    for (int i = x; i <= pos[x] * block; i++) a[i] = a[i] + v;
    for (int i = (pos[y] - 1) * block + 1; i <= y; i++) a[i] = a[i] + v;
  }
  reset(pos[x]);
  reset(pos[y]);
  for (int i = pos[x] + 1; i < pos[y]; i++) add[i] += v;
}
long long query(long long x, long long y, long long v) {
  long long sum = 0;
  if (pos[x] == pos[y]) {
    for (int i = x; i <= y; i++)
      if (a[i] + add[pos[i]] == v) sum++;
  } else {
    for (int i = x; i <= pos[x] * block; i++)
      if (a[i] + add[pos[i]] == v) sum++;
    for (int i = (pos[y] - 1) * block + 1; i <= y; i++)
      if (a[i] + add[pos[i]] == v) sum++;
  }
  for (int i = pos[x] + 1; i < pos[y]; i++) sum += find(i, v - add[i]);
  return sum;
}
long long deall(long long x, long long y, long long v) {
  long long sum = 0;
  if (pos[x] == pos[y]) {
    for (int i = x; i <= y; i++)
      if (a[i] + add[pos[i]] == v) return i;
  } else {
    for (int i = x; i <= pos[x] * block; i++)
      if (a[i] + add[pos[i]] == v) return i;
    for (int i = pos[x] + 1; i < pos[y]; i++) {
      int d = find(i, v - add[i]);
      if (d > 0) {
        for (int j = i * block - block + 1; j <= i * block; j++)
          if (a[j] + add[pos[j]] == v) return j;
      }
    }
    for (int i = (pos[y] - 1) * block + 1; i <= y; i++)
      if (a[i] + add[pos[i]] == v) return i;
  }
}
long long dealr(long long x, long long y, long long v) {
  long long sum = 0;
  if (pos[x] == pos[y]) {
    for (int i = y; i >= x; i--)
      if (a[i] + add[pos[i]] == v) return i;
  } else {
    for (int i = y; i >= (pos[y] - 1) * block + 1; i--)
      if (a[i] + add[pos[i]] == v) return i;
    for (int i = pos[y]; i >= pos[x] + 1; i--) {
      int d = find(i, v - add[i]);
      if (d > 0) {
        for (int j = i * block; j >= i * block - block; j--)
          if (a[j] + add[pos[j]] == v) return j;
      }
    }
    for (int i = pos[x] * block; i >= x; i--)
      if (a[i] + add[pos[i]] == v) return i;
  }
}
int ask(long long cc) {
  int aa = query(1, n, cc);
  if (aa == 0) return -1;
  return dealr(1, n, cc) - deall(1, n, cc);
}
int main() {
  n = read(), q = read();
  block = int(sqrt(n));
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    pos[i] = (i - 1) / block + 1;
    b[i] = a[i];
  }
  int x, y, v, ch;
  if (n % block)
    m = n / block + 1;
  else
    m = n / block;
  for (int i = 1; i <= m; i++) reset(i);
  for (int i = 1; i <= q; i++) {
    ch = read();
    if (ch == 1) {
      x = read(), y = read(), v = read();
      update(x, y, v);
    } else {
      int p;
      p = read();
      printf("%d\n", ask(p));
    }
  }
  return 0;
}
