#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, r;
  cin >> n >> r;
  double a[1 << n];
  double sum = 0LL;
  for (int i = 0; i < (1 << n); i++) {
    cin >> a[i];
    sum += a[i];
  }
  double all = 1.0;
  for (int i = 0; i < n; i++) {
    all *= 2.0;
  }
  cout << fixed << setprecision(20) << (sum / all) << "\n";
  for (int i = 0; i < r; i++) {
    int ind;
    double d;
    cin >> ind >> d;
    sum -= a[ind];
    sum += d;
    a[ind] = d;
    cout << fixed << setprecision(20) << (sum / all) << "\n";
  }
}
