#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, R;
  cin >> N >> R;
  long long NN = 1 << N, sum = 0;
  vector<long long> a(NN);
  for (int i = 0; i < NN; ++i) {
    long long x;
    cin >> x;
    sum += x;
    a[i] = x;
  }
  cout << setprecision(8) << fixed << endl;
  cout << 1.0 * sum / NN << endl;
  for (int i = 0; i < R; ++i) {
    long long x, y;
    cin >> x >> y;
    sum -= a[x];
    a[x] = y;
    sum += y;
    cout << 1.0 * sum / NN << endl;
  }
  return 0;
}
