#include <bits/stdc++.h>
using namespace std;
int n, r, i, x;
double a[300000], t, y;
int main() {
  scanf("%d%d", &n, &r);
  n = (1 << n);
  for (i = 0; i < n; i++) scanf("%lf", &a[i]), t += a[i] / n;
  printf("%lf\n", t);
  for (i = 1; i <= r; i++) {
    scanf("%d%lf", &x, &y);
    t = t + (y - a[x]) / n;
    a[x] = y;
    printf("%lf\n", t);
  }
  return 0;
}
