#include <bits/stdc++.h>
using namespace std;
int n, q;
double v[(1 << 18)], sum;
int main() {
  cin >> n >> q;
  for (int i = 0; i < (1 << n); i++) {
    scanf("%lf", &v[i]);
    sum += v[i];
  }
  for (int i = 0; i <= q; i++) {
    printf("%.12f\n", sum / (double)(1 << n));
    if (i == q) return 0;
    int x;
    double hoge;
    scanf("%d%lf", &x, &hoge);
    sum += hoge - v[x];
    v[x] = hoge;
  }
}
