#include <bits/stdc++.h>
using namespace std;
int n, r;
int a[1 << 18];
double an = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  cin >> n >> r;
  for (int i = 0; i < (1 << n); i++) {
    cin >> a[i];
    an += a[i];
  }
  cout << an * pow(2, -n) << '\n';
  for (int i = 0; i < r; i++) {
    int pos, val;
    cin >> pos >> val;
    an -= a[pos];
    a[pos] = val;
    an += a[pos];
    cout << an * pow(2, -n) << '\n';
  }
}
