#include <bits/stdc++.h>
using namespace std;
long long nums[270000], sum;
int n, r;
int main() {
  while (cin >> n >> r) {
    sum = 0;
    for (int i = 0; i < (1 << n); i++) {
      cin >> nums[i];
      sum += nums[i];
    }
    cout << sum * 1.0 / (1 << n) << endl;
    for (int i = 0; i < r; i++) {
      int a, b;
      cin >> a >> b;
      sum -= nums[a];
      nums[a] = b;
      sum += nums[a];
      cout << sum * 1.0 / (1 << n) << endl;
    }
  }
  return 0;
}
