#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
long double arr[maxn];
void solve() {
  int n, q;
  scanf("%d", &n);
  scanf("%d", &q);
  n = 1ll << n;
  long double sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%Lf", &arr[i]);
    sum += arr[i];
  }
  printf("%.12Lf\n", sum / n);
  while (q--) {
    int ind;
    long double val;
    scanf("%d", &ind);
    scanf("%Lf", &val);
    sum += val;
    sum -= arr[ind + 1];
    arr[ind + 1] = val;
    printf("%.12Lf\n", sum / n);
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
