#include <bits/stdc++.h>
using namespace std;
int n, r, a[262155], uu, vv;
long long sum;
int main() {
  cin >> n >> r;
  for (int i = 0; i < (1 << n); i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  printf("%.12f\n", (double)sum / (1 << n));
  while (r--) {
    scanf("%d %d", &uu, &vv);
    sum -= a[uu];
    a[uu] = vv;
    sum += a[uu];
    printf("%.12f\n", (double)sum / (1 << n));
  }
  return 0;
}
