#include <bits/stdc++.h>
using namespace std;
const int nmax = 1 << 18;
int v[nmax + 1];
int main() {
  int n, r;
  fscanf(stdin, "%d%d", &n, &r);
  long long s = 0;
  for (int i = 0; i < (1 << n); ++i) {
    fscanf(stdin, "%d", &v[i]);
    s += v[i];
  }
  int ct = 1 << n;
  fprintf(stdout, "%.8lf\n", (double)s / ct);
  while (r--) {
    int x, y;
    fscanf(stdin, "%d%d", &x, &y);
    s -= v[x];
    s += y;
    v[x] = y;
    fprintf(stdout, "%.8lf\n", (double)s / ct);
  }
  return 0;
}
