#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, tt;
  cin >> n >> tt;
  vector<int> a(1 << n);
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> a[i];
    sum += (long long)a[i];
  }
  cout << fixed << setprecision(17) << (double)sum / (1 << n) << '\n';
  while (tt--) {
    int x, y;
    cin >> x >> y;
    sum += y - a[x];
    a[x] = y;
    cout << fixed << setprecision(17) << (double)sum / (1 << n) << '\n';
  }
  return 0;
}
