#include <bits/stdc++.h>
using namespace std;
int n, m, x, p[100100], nrofel, y, cn, tip;
long long S, ls, sum;
struct Tr {
  Tr *l, *r;
  int cn, k, pr;
  long long s;
  Tr(int _k) {
    cn = 1;
    k = _k;
    s = _k;
    pr = rand();
    l = r = NULL;
  }
};
Tr *R;
long long fs(Tr *t) {
  if (!t) return 0;
  return t->s;
}
int cnt(Tr *t) {
  if (!t) return 0;
  return t->cn;
}
void upd(Tr *&t) {
  if (!t) return;
  t->cn = cnt(t->l) + cnt(t->r) + 1;
  t->s = fs(t->l) + fs(t->r) + t->k;
}
void split(Tr *t, Tr *&l, Tr *&r, int k) {
  if (!t) {
    l = r = t;
    return;
  }
  if (k <= t->k)
    split(t->l, l, t->l, k), r = t;
  else
    split(t->r, t->r, r, k), l = t;
  upd(t);
}
void merge(Tr *&t, Tr *l, Tr *r) {
  if (!l || !r) {
    t = l ? l : r;
    upd(t);
    return;
  }
  if (l->pr > r->pr)
    merge(l->r, l->r, r), t = l;
  else
    merge(r->l, l, r->l), t = r;
  upd(t);
}
void insert(Tr *&t, Tr *it) {
  if (!t) {
    t = it;
    return;
  }
  if (it->pr > t->pr)
    split(t, it->l, it->r, it->k), t = it;
  else if (it->k == t->k) {
    if (rand() % 2)
      insert(t->l, it);
    else
      insert(t->r, it);
  } else if (it->k < t->k)
    insert(t->l, it);
  else
    insert(t->r, it);
  upd(t);
}
void erase(Tr *&t, int x) {
  if (t->k == x) {
    merge(t, t->l, t->r);
    return;
  }
  if (x < t->k)
    erase(t->l, x);
  else
    erase(t->r, x);
  upd(t);
}
void dfs(Tr *t) {
  if (!t) return;
  nrofel += cnt(t->l);
  if (t->k == (1 << 30) || 1LL * t->k * nrofel - S - sum - fs(t->l) >= 0) {
    ls = sum + fs(t->l);
    cn = nrofel;
    nrofel -= cnt(t->l);
    dfs(t->l);
  } else {
    nrofel++;
    sum += fs(t->l) + t->k;
    dfs(t->r);
  }
}
int main() {
  cin >> n >> m;
  Tr *it = new Tr(1 << 30);
  insert(R, it);
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    p[i] = x;
    Tr *it = new Tr(x);
    insert(R, it);
  }
  for (int i = 1; i <= m; ++i) {
    cin >> tip;
    if (tip == 2) {
      nrofel = 0;
      sum = 0;
      cin >> S;
      if (i == 4) {
        i++;
        i--;
      }
      dfs(R);
      long double t = S + ls;
      t /= cn;
      cout << fixed << setprecision(5) << t << "\n";
    } else {
      cin >> x >> y;
      erase(R, p[x]);
      p[x] = y;
      Tr *it = new Tr(y);
      insert(R, it);
    }
  }
  return 0;
}
