#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
int n, r;
double p[N], a;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
int main() {
  n = read(), r = read();
  n = (1 << n);
  for (int i = 0; i < n; i++) scanf("%lf", &p[i]), a += p[i] / n;
  printf("%lf\n", a);
  for (int i = 1; i <= r; i++) {
    int x;
    double y;
    scanf("%d%lf", &x, &y);
    a += (y - p[x]) / n;
    p[x] = y;
    printf("%lf\n", a);
  }
  return 0;
}
