#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <typename Args>
void kill(Args args) {
  cout << args << "\n";
  exit(0);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const int N = 1 << 19;
long double arr[N];
long double mul = 1;
int n, r;
void solve(int testnum) {
  cin >> n >> r;
  for (int i = 1; i <= n; i++) {
    mul *= 0.5;
  }
  long double sum = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  cout << sum * mul << "\n";
  for (int i = 1; i <= r; i++) {
    int g;
    long double x;
    cin >> g >> x;
    sum -= arr[g];
    sum += x;
    arr[g] = x;
    cout << mul * sum << "\n";
  }
}
void precompute() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  int testcase = 1;
  clock_t zzzx = clock();
  precompute();
  for (int i = 1; i <= testcase; i++) {
    solve(i);
  }
  double elapsed_time = (double)(clock() - zzzx) / CLOCKS_PER_SEC;
  cerr << "elapsed_time"
       << " = " << (elapsed_time) << "\n";
  return 0;
}
