#include <bits/stdc++.h>
using namespace std;
long long tree[1000003 * 4], a[1000003], n, q;
void build(int idx, int l, int r) {
  if (l == r) {
    tree[idx] = a[l];
    return;
  }
  build(2 * idx, l, (l + r) / 2);
  build(2 * idx + 1, (l + r) / 2 + 1, r);
  tree[idx] = tree[idx * 2] + tree[idx * 2 + 1];
}
void upd(int idx, int l, int r, int in, int val) {
  if (in > r || in < l) return;
  if (l == r) {
    tree[idx] = val;
    return;
  }
  upd(2 * idx, l, (l + r) / 2, in, val);
  upd(2 * idx + 1, (l + r) / 2 + 1, r, in, val);
  tree[idx] = tree[idx * 2] + tree[idx * 2 + 1];
}
int main() {
  cin >> n >> q;
  long long banyak = 1 << n;
  for (int i = 0; i < 1 << n; i++) {
    cin >> a[i];
  }
  build(1, 0, (1 << n) - 1);
  double jaw = (double)(tree[1]) / (double)(banyak);
  cout << fixed << setprecision(9) << jaw << endl;
  while (q--) {
    int x, y;
    cin >> x >> y;
    upd(1, 0, banyak - 1, x, y);
    jaw = (double)(tree[1]) / (double)(banyak);
    cout << fixed << setprecision(9) << jaw << endl;
  }
}
