#include <bits/stdc++.h>
using namespace std;
long long n, r, sum(0);
vector<long long> x;
int main() {
  cin >> n >> r;
  double c = 1 << n;
  for (long long i = 0; i < c; i++) {
    long long a;
    cin >> a;
    x.push_back(a);
    sum += a;
  }
  cout << setprecision(10) << fixed << (double)sum / c << "\n";
  for (long long i = 0; i < r; i++) {
    long long z, g;
    cin >> z >> g;
    sum += g;
    sum -= x[z];
    x[z] = g;
    cout << fixed << (double)sum / c << "\n";
  }
  return 0;
}
