#include <bits/stdc++.h>
using namespace std;
int v[(1 << 18) + 5];
int main() {
  int n, r;
  cin >> n >> r;
  long long s = 0;
  for (int i = 0; i < (1 << n); ++i) {
    cin >> v[i];
    s += v[i];
  }
  printf("%.6f\n", (double)s / (1 << n));
  for (int i = 1; i <= r; ++i) {
    int x, y;
    cin >> x >> y;
    s = (s - v[x] + y);
    v[x] = y;
    printf("%.6f\n", (double)s / (1 << n));
  }
  return 0;
}
