#include <bits/stdc++.h>
using namespace std;
long long nums[270000], sum;
int n, r;
void ans(long long sum, int len) {
  long long head = sum / len;
  long long tail = sum % len * 1000000;
  tail /= len;
  printf("%lld.%lld\n", head, tail);
}
int main() {
  while (cin >> n >> r) {
    sum = 0;
    for (int i = 0; i < (1 << n); i++) {
      cin >> nums[i];
      sum += nums[i];
    }
    ans(sum, 1 << n);
    for (int i = 0; i < r; i++) {
      int a, b;
      cin >> a >> b;
      sum -= nums[a];
      nums[a] = b;
      sum += nums[a];
      ans(sum, 1 << n);
    }
  }
  return 0;
}
