#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
const int MAXR = (1 << 18) + 20;
int n, r, c[MAXR];
long long sum;
void load() {
  cin >> n >> r;
  for (int i = 0; i < (1 << n); i++) {
    cin >> c[i];
    sum += c[i];
  }
}
long double get() { return (long double)sum / (1 << n); }
void solve() {
  cout << get() << '\n';
  for (int i = 0; i < r; i++) {
    int z, g;
    cin >> z >> g;
    sum = sum - c[z] + g;
    c[z] = g;
    cout << get() << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(6);
  cout << fixed << showpoint;
  load();
  solve();
  return 0;
}
