#include <bits/stdc++.h>
using namespace std;
double const EPS = 1.0E-9;
int const MOD = (int)1e9 + 7;
inline int read(char* s) { return scanf("%s", s); }
inline int read(int& x) { return scanf("%d", &(x)); }
inline int read(long long& x) { return scanf("%lld", &x); }
inline int read(double& x) { return scanf("%lf", &x); }
inline int writeln(int x) { return printf("%d\n", x); }
inline int writeln(long long x) { return printf("%lld\n", x); }
inline int writeln(double x) { return printf("%.12f\n", x); }
template <typename... T>
int read(T&... args) {
  using swallow = int[];
  swallow w = {0, (read(args))...};
  return sizeof(w) / sizeof(w[0]) - 1;
}
template <typename T>
int read(std::vector<T>& v) {
  for (T& t : v) read(t);
  return (int)v.size();
}
inline long long gcd(long long x, long long y) {
  return y == 0 ? x : gcd(y, x % y);
}
inline long long lcm(long long x, long long y) {
  return x == 0 && y == 0 ? 0 : x / gcd(x, y) * y;
}
inline long long powmod(long long x, long long n, long long m = MOD) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x) % m;
    x = (x * x) % m;
    n /= 2;
  }
  return r;
}
static int leap(int y) { return y % 4 == 0 && y % 100 != 0 || y % 400 == 0; }
static int const month[2][12] = {
    {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
    {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
static const int maxn = 1 << 19;
static const int maxm = 1 << 20;
int n, q;
int a[maxn];
long long sum;
static int solve() {
  read(n, q);
  for (int i = 0; i < (1 << n); ++i) {
    read(a[i]);
    sum += a[i];
  }
  writeln((double)sum / (1 << n));
  for (int i = (0), vzq_b = (q); i < vzq_b; ++i) {
    int z, g;
    read(z, g);
    sum += g - a[z];
    a[z] = g;
    writeln((double)sum / (1 << n));
  }
  return 0;
}
int main(int argc, char* argv[]) {
  solve();
  return 0;
}
