#include <bits/stdc++.h>
using namespace std;
const int max_node = 3000000;
long long tree[max_node];
long long tree2[max_node];
long long A[max_node];
map<long long, long long> my, my2;
void update(int node, int start, int _end, int idx, long long val) {
  if (start == _end)
    tree[node] += val;
  else {
    int mid = (start + _end) / 2;
    if (start <= idx && idx <= mid)
      update(node * 2, start, mid, idx, val);
    else
      update(node * 2 + 1, mid + 1, _end, idx, val);
    tree[node] = tree[2 * node] + tree[2 * node + 1];
  }
}
long long query(int node, int start, int _end, int l, int r) {
  if (r < start || l > _end) {
    return 0;
  }
  if (l <= start && _end <= r) return tree[node];
  int mid = (start + _end) / 2;
  long long x1 = query(2 * node, start, mid, l, r);
  long long x2 = query(2 * node + 1, mid + 1, _end, l, r);
  return (x1 + x2);
}
void update2(int node, int start, int _end, int idx, long long val) {
  if (start == _end)
    tree2[node] += val;
  else {
    int mid = (start + _end) / 2;
    if (start <= idx && idx <= mid)
      update2(node * 2, start, mid, idx, val);
    else
      update2(node * 2 + 1, mid + 1, _end, idx, val);
    tree2[node] = tree2[2 * node] + tree2[2 * node + 1];
  }
}
long long query2(int node, int start, int _end, int l, int r) {
  if (r < start || l > _end) {
    return 0;
  }
  if (l <= start && _end <= r) return tree2[node];
  int mid = (start + _end) / 2;
  long long x1 = query2(2 * node, start, mid, l, r);
  long long x2 = query2(2 * node + 1, mid + 1, _end, l, r);
  return (x1 + x2);
}
int main() {
  int n, q;
  cin >> n >> q;
  vector<long long> v;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &A[i]);
    v.push_back(A[i]);
  }
  vector<long long> que[q];
  for (int i = 0; i < q; i++) {
    long long x, y;
    scanf("%I64d%I64d", &x, &y);
    que[i].push_back(x);
    que[i].push_back(y);
    if (x == 1) {
      scanf("%I64d", &x);
      que[i].push_back(x);
      v.push_back(x);
    }
  }
  sort(v.begin(), v.end());
  int cnt = 1;
  long long last = -1;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] != last) {
      my[v[i]] = cnt;
      my2[cnt] = v[i];
      cnt++;
    }
    last = v[i];
  }
  int TT = cnt - 1;
  for (int i = 1; i <= n; i++) {
    update(1, 1, TT, my[A[i]], A[i]);
    update2(1, 1, TT, my[A[i]], 1);
  }
  for (int i = 0; i < q; i++) {
    if (que[i].size() == 2) {
      long long x, y;
      x = que[i][0];
      y = que[i][1];
      int st = 1, En = TT;
      double ans = 1e18;
      while (st <= En) {
        int mid = (st + En) / 2;
        long long sum = query(1, 1, TT, 1, mid);
        long long maxx = my2[mid];
        long long c = query2(1, 1, TT, 1, mid);
        long long sum2 = maxx * c;
        long long sum3 = sum2 - sum;
        long long sum4 = y - sum3;
        double ans2 = maxx;
        if (sum4 > 0 && c != 0) ans2 += (1.0 * sum4 / c);
        if (sum4 < 0 && c != 0) {
          En = mid - 1;
        } else {
          st = mid + 1;
        }
        if (c != 0) ans = min(ans, ans2);
      }
      printf("%.6f\n", ans);
    } else {
      long long x, y, z;
      x = que[i][0];
      y = que[i][1];
      z = que[i][2];
      long long temp = A[y];
      temp = my[temp];
      update(1, 1, TT, temp, -A[y]);
      update2(1, 1, TT, temp, -1);
      A[y] = z;
      z = my[z];
      update(1, 1, TT, z, A[y]);
      update2(1, 1, TT, z, 1);
    }
  }
}
