#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 20) + 10;
int a[MX];
int main() {
  int n, r;
  ignore = scanf("%d %d", &n, &r);
  for (int i = 0; i < (1 << n); i++) {
    ignore = scanf("%d", &a[i]);
  }
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    sum += a[i];
  }
  printf("%Lf\n", (sum) / (long double)(1 << n));
  for (int i = 0; i < r; i++) {
    int x, y;
    ignore = scanf("%d %d", &x, &y);
    sum -= a[x];
    a[x] = y;
    sum += a[x];
    printf("%Lf\n", (sum) / (long double)(1 << n));
  }
  return 0;
}
