#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T Dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Chkbit(int N, int pos) { return (bool)(N & (1 << pos)); }
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
long long int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int n, m;
long long int ar[1000007];
struct z {
  int id, p;
  long long int val;
  z() {}
  z(int _, int __, long long int ___) {
    id = _, p = __;
    val = ___;
  }
};
z Ar[1000007];
map<long long int, int> mp, mp1;
vector<long long int> v;
long long int Tree[1000007];
long long int Tree1[1000007];
int MxVal;
void Update(int id, long long int Val) {
  while (id <= MxVal) {
    Tree[id] += Val;
    id += id & -id;
  }
}
void Update1(int id, int val) {
  while (id <= MxVal) {
    Tree1[id] += val;
    id += id & -id;
  }
}
long long int Query(int id) {
  long long int ans = 0;
  while (id > 0) {
    ans += Tree[id];
    id -= id & -id;
  }
  return ans;
}
int Query1(int id) {
  int ans = 0;
  while (id > 0) {
    ans += Tree1[id];
    id -= id & -id;
  }
  return ans;
}
int Check(double a, double b) {
  if (a - b > 1e-4) return 1;
  return 0;
}
int FindId1(long long int val) {
  long long int Id =
      lower_bound(v.begin(), v.end(), (long long int)val) - v.begin();
  Id++;
  return Id;
}
int FindId(long long int val) {
  long long int Id =
      lower_bound(v.begin(), v.end(), (long long int)val) - v.begin();
  if (mp1[val] == 0)
    ;
  else
    Id++;
  return Id;
}
double FinD(double val) {
  long long int Id = FindId((long long int)val);
  long long int Sum = Query(Id);
  Id = Query1(Id);
  double Tot = (1.0 * Id * val) - Sum;
  return Tot;
}
double solve(double val) {
  double l = 0.0, h = 500000000000000000 * 1.0, mid;
  double ans = -1.0;
  while (Check(h, l)) {
    double mid = (l + h) / 2.0;
    double An = FinD(mid);
    if (An >= val) {
      ans = mid;
      h = mid;
    } else {
      l = mid;
    }
  }
  return ans;
}
int main() {
  n = in<int>(), m = in<int>();
  for (int i = 1; i < n + 1; i++) {
    ar[i] = in<long long int>();
    if (mp[ar[i]] == 0) {
      mp[ar[i]] = 1;
    }
  }
  for (int i = 1; i < m + 1; i++) {
    int id;
    id = in<int>();
    int p = -1;
    long long int val;
    if (id == 1) {
      p = in<int>();
      val = in<long long int>();
    } else {
      val = in<long long int>();
    }
    mp[val] = 1;
    Ar[i] = z(id, p, val);
  }
  map<long long int, int>::iterator it;
  for (it = mp.begin(); it != mp.end(); it++) {
    v.push_back(it->first);
    mp1[v[v.size() - 1]] = 1;
  }
  MxVal = 2 * v.size();
  long long int sm = 0;
  for (int i = 1; i < n + 1; i++) {
    int Id = lower_bound(v.begin(), v.end(), ar[i]) - v.begin();
    Id++;
    Update(Id, ar[i]);
    Update1(Id, 1);
    sm += ar[i];
  }
  for (int i = 1; i < m + 1; i++) {
    int id, p;
    long long int val;
    id = Ar[i].id, p = Ar[i].p, val = Ar[i].val;
    if (id == 1) {
      int Id = FindId1(ar[p]);
      long long int diff = -ar[p];
      Update(Id, diff);
      Update1(Id, -1);
      Id = FindId1(val);
      Update1(Id, 1);
      Update(Id, val);
      ar[p] = val;
    } else {
      double ans = solve(val * 1.0);
      printf("%.6lf\n", ans);
    }
  }
  return 0;
}
