#include <bits/stdc++.h>
using namespace std;
const int MAXN = 111111;
int h[MAXN];
int ho[MAXN];
int type[MAXN];
int p[MAXN];
int x[MAXN];
int xo[MAXN];
int t[MAXN << 2];
long long v[MAXN];
vector<int> cand;
template <class T>
class segment_tree {
 public:
  T t[MAXN << 3];
  void update(int here, int l, int r, int there, T val) {
    if (l == r) {
      t[here] += val;
      return;
    }
    int mid = (l + r) / 2;
    if (there <= mid) {
      update(here * 2, l, mid, there, val);
    } else {
      update(here * 2 + 1, mid + 1, r, there, val);
    }
    t[here] = t[here * 2] + t[here * 2 + 1];
  }
  T query(int here, int l, int r, int s, int e) {
    if (r < s || e < l) return 0;
    if (s <= l && r <= e) return t[here];
    int mid = (l + r) / 2;
    return query(here * 2, l, mid, s, e) +
           query(here * 2 + 1, mid + 1, r, s, e);
  }
};
segment_tree<int> stcnt;
segment_tree<long long> stval;
int main() {
  int n, q, i;
  scanf("%d%d", &n, &q);
  for (i = 0; i < n; i++) {
    scanf("%d", &h[i]);
  }
  for (i = 0; i < q; i++) {
    scanf("%d", &type[i]);
    if (type[i] == 1) {
      scanf("%d%d", &p[i], &x[i]);
    } else {
      scanf("%I64d", &v[i]);
    }
  }
  for (i = 0; i < n; i++) {
    cand.push_back(h[i]);
  }
  for (i = 0; i < q; i++) {
    if (type[i] == 1) cand.push_back(x[i]);
  }
  sort(cand.begin(), cand.end());
  cand.erase(unique(cand.begin(), cand.end()), cand.end());
  for (i = 0; i < n; i++) {
    ho[i] = distance(cand.begin(), lower_bound(cand.begin(), cand.end(), h[i]));
  }
  for (i = 0; i < q; i++) {
    if (type[i] == 1)
      xo[i] =
          distance(cand.begin(), lower_bound(cand.begin(), cand.end(), x[i]));
  }
  for (i = 0; i < n; i++) {
    stcnt.update(1, 0, cand.size() - 1, ho[i], 1);
    stval.update(1, 0, cand.size() - 1, ho[i], h[i]);
  }
  for (i = 0; i < q; i++) {
    if (type[i] == 1) {
      int here = p[i] - 1;
      stcnt.update(1, 0, cand.size() - 1, ho[here], -1);
      stval.update(1, 0, cand.size() - 1, ho[here], -h[here]);
      h[here] = x[i];
      ho[here] = distance(cand.begin(),
                          lower_bound(cand.begin(), cand.end(), h[here]));
      stcnt.update(1, 0, cand.size() - 1, ho[here], 1);
      stval.update(1, 0, cand.size() - 1, ho[here], h[here]);
    } else {
      int l = 0, r = cand.size() - 1, mid, cnt;
      long long val;
      while (l < r) {
        mid = (l + r) / 2;
        cnt = stcnt.query(1, 0, cand.size() - 1, 0, mid);
        val = stval.query(1, 0, cand.size() - 1, 0, mid);
        if ((long long)cand[mid] * cnt - val < v[i]) {
          l = mid + 1;
        } else {
          r = mid;
        }
      }
      mid = l;
      cnt = stcnt.query(1, 0, cand.size() - 1, 0, mid);
      val = stval.query(1, 0, cand.size() - 1, 0, mid);
      if ((long long)cand[mid] * cnt - val >= v[i]) {
        mid--;
      }
      cnt = stcnt.query(1, 0, cand.size() - 1, 0, mid);
      val = stval.query(1, 0, cand.size() - 1, 0, mid);
      printf("%lf\n", (double)(val + v[i]) / cnt);
    }
  }
  return 0;
}
