#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000007;
const long long DMAX = 300000 + 15;
const long long MOD = 1000000007;
template <class T>
inline void read(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      f = -1;
    }
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  x *= f;
}
template <class T>
void print(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int a[20];
  int cnt = 0;
  do {
    a[++cnt] = x % 10;
    x /= 10;
  } while (x > 0);
  for (int i = cnt; i >= 1; i--) {
    putchar(a[i] + '0');
  }
  puts("");
}
struct SegTree {
  long long sum;
  long long l, r;
  long long cnt;
};
SegTree tr[DMAX << 2];
void pushup(long long p) {
  tr[p].cnt = tr[p << 1].cnt + tr[p << 1 | 1].cnt;
  tr[p].sum = tr[p << 1].sum + tr[p << 1 | 1].sum;
}
void build(long long p, long long l, long long r) {
  tr[p].l = l, tr[p].r = r;
  if (l == r) {
    return;
  }
  long long mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
struct DEF {
  long long sum, cnt;
};
struct quest {
  long long ope;
  long long x, y;
};
quest q[DMAX];
long long n, m;
long long h[DMAX];
long long len;
long long a[DMAX], des = 0;
void modify(long long p, long long pos, long long val, long long wer) {
  if (tr[p].l == tr[p].r) {
    tr[p].sum += val * wer;
    tr[p].cnt += wer;
    return;
  }
  long long mid = (tr[p].l + tr[p].r) >> 1;
  if (pos <= mid) {
    modify(p << 1, pos, val, wer);
  } else {
    modify(p << 1 | 1, pos, val, wer);
  }
  pushup(p);
}
DEF query(long long p, long long l, long long r) {
  if (l > r) {
    return DEF{0, 0};
  }
  if (r < tr[p].l || tr[p].r < l) {
    return DEF{0, 0};
  }
  if (l <= tr[p].l && tr[p].r <= r) {
    return DEF{tr[p].sum, tr[p].cnt};
  }
  long long mid = (tr[p].l + tr[p].r) >> 1;
  DEF t, j;
  t.sum = t.cnt = j.sum = j.cnt = 0;
  if (l <= mid) {
    t = query(p << 1, l, r);
  }
  if (r > mid) {
    j = query(p << 1 | 1, l, r);
  }
  return DEF{t.sum + j.sum, t.cnt + j.cnt};
}
bool check(double val, double pol) {
  long long pos = upper_bound(a + 1, a + len + 1, (double)val) - a - 1;
  DEF red = query(1, 1, pos);
  if (red.cnt * val - red.sum >= pol) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  read(n), read(m);
  for (int i = 1; i <= n; i++) {
    read(h[i]);
    a[++des] = h[i];
  }
  for (int i = 1; i <= m; i++) {
    read(q[i].ope);
    if (q[i].ope == 1) {
      read(q[i].x), read(q[i].y);
      a[++des] = q[i].y;
    }
    if (q[i].ope == 2) {
      read(q[i].x);
    }
  }
  sort(a + 1, a + des + 1);
  len = unique(a + 1, a + des + 1) - a - 1;
  build(1, 1, len);
  for (int i = 1; i <= n; i++) {
    long long pos = lower_bound(a + 1, a + len + 1, h[i]) - a;
    modify(1, pos, h[i], 1);
  }
  for (int i = 1; i <= m; i++) {
    if (q[i].ope == 1) {
      long long pos = lower_bound(a + 1, a + len + 1, h[q[i].x]) - a;
      modify(1, pos, h[q[i].x], -1);
      h[q[i].x] = q[i].y;
      pos = lower_bound(a + 1, a + len + 1, h[q[i].x]) - a;
      modify(1, pos, h[q[i].x], 1);
    }
    if (q[i].ope == 2) {
      double l = 0, r = q[i].x + 1e9;
      for (int j = 0; j <= 100; j++) {
        double mid = (l + r) / 2;
        if (check(mid, q[i].x)) {
          r = mid;
        } else {
          l = mid;
        }
      }
      printf("%.8lf\n", l);
    }
  }
  return 0;
}
