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