#include <bits/stdc++.h>
using namespace std;
const int N = 19;
int a[1 << N];
int main() {
  int n, q;
  cin >> n >> q;
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) cin >> a[i], sum += a[i];
  cout << setprecision(10) << 1.0 * sum / (1 << n) << "\n";
  for (int i = 0; i < q; i++) {
    int id, v;
    cin >> id >> v;
    sum += v - a[id];
    a[id] = v;
    cout << setprecision(10) << 1.0 * sum / (1 << n) << "\n";
  }
}
