#include <bits/stdc++.h>
using namespace std;
int numbers[1 << 18];
int main() {
  cin.tie(nullptr);
  cin.sync_with_stdio(false);
  int n, r;
  cin >> n >> r;
  long long sum = 0;
  for (int i = 0; i < (1 << n); i++) cin >> numbers[i];
  for (int i = 0; i < (1 << n); i++) sum += numbers[i];
  long long N = 1 << n;
  cout << setprecision(15) << fixed;
  cout << (double)sum / N << "\n";
  for (int i = 0; i < r; i++) {
    int a, b;
    cin >> a >> b;
    sum += b;
    sum -= numbers[a];
    numbers[a] = b;
    cout << (double)sum / N << "\n";
  }
}
