#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(6);
  int n, r, a;
  long long tot = 0, b;
  cin >> n >> r;
  vector<int> arr(1 << n);
  for (int i = 0; i < arr.size(); ++i) {
    cin >> arr[i];
    tot += arr[i];
  }
  cout << tot / ((1 << n) + 0.0) << "\n";
  for (int i = 0; i < r; ++i) {
    cin >> a >> b;
    tot += b - arr[a];
    arr[a] = b;
    cout << tot / ((1 << n) + 0.0) << "\n";
  }
}
