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