#include <bits/stdc++.h>
using namespace std;
int gi() {
  int a;
  scanf("%d", &a);
  return a;
}
long long gli() {
  long long a;
  scanf("%I64d", &a);
  return a;
}
int a[262144];
int main() {
  int b = gi();
  int r = gi();
  int n = 1 << b;
  long long s = 0;
  for (int i = 0; i < n; i++) {
    a[i] = gi();
    s += a[i];
  }
  printf("%.8lf\n", double(s) / double(n));
  for (int i = 0; i < r; i++) {
    int j = gi();
    int v = gi();
    s += v - a[j];
    a[j] = v;
    printf("%.8lf\n", double(s) / double(n));
  }
  return 0;
}
