#include <bits/stdc++.h>
using namespace std;
long long N, R, c[262144 + 5], sum = 0;
struct idontknow {
  long long z, g;
} r[262144 + 5];
void solution1() {
  for (int i = 0; i < R; i++) {
    if (0) cout << sum << endl;
    printf("%6lf\n", (double)sum / (double)pow(2, N));
    sum += r[i].g - c[r[i].z];
    c[r[i].z] = r[i].g;
  }
  printf("%6lf\n", (double)sum / (double)pow(2, N));
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> R;
  for (int i = 0; i < pow(2, N); i++) cin >> c[i], sum += c[i];
  for (int i = 0; i < R; i++) cin >> r[i].z >> r[i].g;
  solution1();
  return 0;
}
