#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
int n, r, a[N];
long long sum;
int main() {
  scanf("%d%d", &n, &r);
  for (int i = 0; i < (1 << n); i++) {
    scanf("%d", a + i);
    sum += a[i];
  }
  printf("%.9lf\n", (sum + .0) / (1 << n));
  for (int i = 0, x; i < r; i++) {
    scanf("%d", &x);
    sum -= a[x];
    scanf("%d", a + x);
    sum += a[x];
    printf("%.9lf\n", (sum + .0) / (1 << n));
  }
}
