#include <bits/stdc++.h>
using namespace std;
const int N = 265000;
int n, q, a[N];
double s;
int main() {
  scanf("%d%d", &n, &q);
  for (int i = (0); i <= (int)(1 << n) - 1; i++) scanf("%d", &a[i]), s += a[i];
  printf("%.10lf\n", 1.0 * s / (1 << n));
  for (int i = (1); i <= (int)q; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    s += y - a[x];
    a[x] = y;
    printf("%.10lf\n", 1.0 * s / (1 << n));
  }
}
