#include <bits/stdc++.h>
using namespace std;
int n, r;
long long A[1000005], sum;
int main() {
  scanf("%d %d", &n, &r);
  for (int i = (0); i < (1 << n); i++) scanf("%lld", &A[i]), sum += A[i];
  printf("%.12lf\n", 1.0 * sum / (1 << n));
  for (int i = (0); i < (r); i++) {
    int x;
    long long y;
    scanf("%d %lld", &x, &y);
    sum += y - A[x];
    A[x] = y;
    printf("%.12lf\n", 1.0 * sum / (1 << n));
  }
  return 0;
}
