#include <bits/stdc++.h>
using namespace std;
long long n, r, p2, sum, A[262145], i, x, y;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> r;
  p2 = 1LL << n;
  for (i = 1; i <= p2; i++) {
    cin >> A[i];
    sum += A[i];
  }
  cout << setprecision(10) << fixed << (1.0 * sum / p2) << "\n";
  for (i = 1; i <= r; i++) {
    cin >> x >> y;
    x++;
    sum -= A[x];
    A[x] = y;
    sum += A[x];
    cout << setprecision(10) << fixed << (1.0 * sum / p2) << "\n";
  }
  return 0;
}
