#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = (1 << 18) + 5;
int main() {
  int n, r;
  double a[maxn], sum = 0;
  cin >> n >> r;
  for (int i = 0; i < 1 << n; i++) {
    scanf("%lf", &a[i]);
    sum += a[i];
  }
  printf("%.7f\n", sum / (1 << n));
  for (int i = 0; i < r; i++) {
    int z;
    double g;
    cin >> z >> g;
    sum -= a[z];
    a[z] = g;
    sum += a[z];
    printf("%.7f\n", sum / (1 << n));
  }
}
