#include <bits/stdc++.h>
using namespace std;
int main() {
  long double a[100000];
  int n;
  cin >> n;
  n = pow(2, n);
  int q;
  cin >> q;
  long double sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < q; i++) {
    int j = 0;
    cin >> j;
    long double a1;
    cin >> a1;
    sum += a1 - a[j];
    a[j] = a1;
    cout << sum / (n * 1.0);
  }
  return 0;
}
