#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  vector<int> a(1 << n);
  long long cur = 0;
  for (int i = 0; i < (1 << n); i++) {
    scanf("%d", &a[i]);
    cur += a[i];
  }
  printf("%.8lf\n", (1.0 * cur) / (1 << n));
  while (q--) {
    int ind, val;
    scanf("%d%d", &ind, &val);
    cur -= a[ind];
    a[ind] = val;
    cur += a[ind];
    printf("%.8lf\n", (1.0 * cur) / (1 << n));
  }
  return 0;
}
