#include <bits/stdc++.h>
using namespace std;
int key = 1;
struct event {
  long long val, id, t, p;
  event(int v_, int id_, int t_) {
    val = v_;
    id = id_;
    t = t_;
    p = 0;
  }
  bool operator<(event B) const {
    if (key == 1 && val != B.val) return val < B.val;
    if (key == 2 && t != B.t) return t < B.t;
    if (val != B.val) return val < B.val;
    if (t != B.t) return t < B.t;
    if (id != B.id) return id < B.id;
    return p < B.p;
  }
};
vector<event> e, ch;
vector<pair<int, long long> > c;
int last[100005], val[100005], here[800005];
long long lazy[800005];
int m;
void Set(int p, int val, int s = 0, int e = m, int x = 1) {
  if (e - s == 1) {
    here[x] = val;
    return;
  }
  int mid = (s + e) / 2;
  if (p < mid)
    Set(p, val, s, mid, 2 * x);
  else
    Set(p, val, mid, e, 2 * x + 1);
  here[x] = here[2 * x] + here[2 * x + 1];
}
int getth(int k, int s = 0, int e = m, int x = 1) {
  if (e - s == 1) return s;
  int mid = (s + e) / 2;
  if (here[2 * x] >= k)
    return getth(k, s, mid, 2 * x);
  else
    return getth(k - here[2 * x], mid, e, 2 * x + 1);
}
void add(int l, int r, int val, int s = 0, int e = m, int x = 1) {
  if (l <= s && e <= r) {
    lazy[x] += val;
    return;
  }
  int mid = (s + e) / 2;
  if (l < mid) add(l, r, val, s, mid, 2 * x);
  if (r > mid) add(l, r, val, mid, e, 2 * x + 1);
}
long long getSum(int p, int s = 0, int e = m, int x = 1) {
  long long ans = 0;
  while (1) {
    ans += lazy[x];
    if (e - s == 1) break;
    int mid = (s + e) / 2;
    if (p < mid) {
      e = mid;
      x = 2 * x;
    } else {
      s = mid;
      x = 2 * x + 1;
    }
  }
  return ans;
}
int main() {
  fill(last, last + 100000, -1);
  int n, q;
  cin >> n >> q;
  int type, p, x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    e.push_back(event(x, i, 0));
    ch.push_back(event(x, i, 0));
  }
  for (int i = 1; i <= q; i++) {
    long long v;
    cin >> type;
    if (type == 1) {
      cin >> p >> x;
      p--;
      e.push_back(event(x, p, i));
      ch.push_back(event(x, p, i));
    } else {
      cin >> v;
      c.push_back(make_pair(i, v));
    }
  }
  sort(e.begin(), e.end());
  sort(ch.begin(), ch.end());
  for (int i = 0; i < e.size(); i++) e[i].p = ch[i].p = i;
  key = 2;
  sort(ch.begin(), ch.end());
  m = e.size();
  int j = 0;
  for (int i = 0; i < c.size(); i++) {
    while (j < ch.size() && ch[j].t < c[i].first) {
      if (last[ch[j].id] >= 0) {
        add(last[ch[j].id], m, -val[ch[j].id]);
        Set(last[ch[j].id], 0);
      }
      last[ch[j].id] = ch[j].p;
      val[ch[j].id] = ch[j].val;
      add(last[ch[j].id], m, val[ch[j].id]);
      Set(last[ch[j].id], 1);
      j++;
    }
    int low = 1, high = n + 1;
    while (high - low > 1) {
      int mid = (low + high) / 2;
      int ip = getth(mid);
      if (e[ip].val * (mid - 1) - getSum(ip - 1) >= c[i].second)
        high = mid;
      else
        low = mid;
    }
    int ip = getth(high - 1);
    cout.precision(5);
    cout << fixed << double(getSum(ip) + c[i].second) / (high - 1) << endl;
  }
  return 0;
}
