#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
struct node {
  int id;
  long long x;
  node(){};
  bool operator<(const node &s) const {
    if (x == s.x) return id < s.id;
    return x < s.x;
  }
} a[N];
int blo, bl[N], n, num;
long long lazy[N];
void update(int l, int r, long long x) {
  for (int i = (bl[l] - 1) * blo + 1; i <= bl[l] * blo; i++) {
    if (a[i].id >= l && a[i].id <= r) a[i].x += x;
  }
  sort(a + (bl[l] - 1) * blo + 1, a + min(bl[l] * blo, n) + 1);
  for (int i = bl[l] + 1; i <= bl[r] - 1; i++) lazy[i] += x;
  if (bl[l] != bl[r]) {
    for (int i = (bl[r] - 1) * blo + 1; i <= min(bl[r] * blo, n); i++) {
      if (a[i].id >= l && a[i].id <= r) a[i].x += x;
    }
    sort(a + (bl[r] - 1) * blo + 1, a + min(bl[r] * blo, n) + 1);
  }
}
long long query(long long y) {
  int ans1 = 0, ans2 = 1, t = -1;
  for (int i = 1; i <= num; i++) {
    t = -1;
    int l = (i - 1) * blo + 1, r = min(n, i * blo);
    long long x = y - lazy[i];
    while (l <= r) {
      int m = (l + r) >> 1;
      if (a[m].x >= x) {
        t = m;
        r = m - 1;
      } else
        l = m + 1;
    }
    if (t != -1 && a[t].x == x) {
      ans2 = a[t].id;
      break;
    }
  }
  for (int i = num; i > 0; i--) {
    t = -1;
    int l = (i - 1) * blo + 1, r = min(n, i * blo);
    long long x = y - lazy[i];
    while (l <= r) {
      int m = (l + r) >> 1;
      if (a[m].x <= x) {
        t = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    if (t != -1 && a[t].x == x) {
      ans1 = a[t].id;
      break;
    }
  }
  return ans1 - ans2;
}
int main(void) {
  int q;
  scanf("%d%d", &n, &q);
  blo = (int)sqrt(n);
  num = n / blo;
  if (n % blo) num++;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i].x);
    a[i].id = i;
    bl[i] = (i - 1) / blo + 1;
  }
  for (int i = 1; i <= num; i++) {
    lazy[i] = 0;
    sort(a + 1 + (i - 1) * blo, a + 1 + min(n, i * blo));
  }
  while (q--) {
    int op, l, r;
    long long x, y;
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d%d%I64d", &l, &r, &x);
      update(l, r, x);
    } else if (op == 2) {
      scanf("%I64d", &y);
      printf("%I64d\n", query(y));
    }
  }
  return 0;
}
