#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int r, n, c[300000], i, j, k, z, g, sum = 0;
  cin >> n >> r;
  for (i = 0; i < (1 << n); i++) {
    cin >> c[i];
    sum = sum + c[i];
  }
  n = 1 << n;
  double ans1, ans2;
  ans1 = (double)sum / n;
  ans2 = ans1;
  cout << ans2 << setprecision(10) << "\n";
  while (r--) {
    cin >> z >> g;
    ans2 = ans1 + (double)(g - c[z]) / n;
    c[z] = g;
    cout << ans2 << setprecision(10) << "\n";
    ans1 = ans2;
  }
}
