#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, r;
  cin >> n >> r;
  vector<double> num(1 << n);
  double ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    cin >> num[i];
    ans += num[i];
  }
  cout << setprecision(7) << ans / (1 << n) << "\n";
  for (int i = 0; i < r; ++i) {
    int temp, val;
    cin >> temp >> val;
    ans += val;
    ans -= num[temp];
    num[temp] = val;
    cout << setprecision(7) << ans / (1 << n) << "\n";
  }
  return 0;
}
