#include <bits/stdc++.h>
using namespace std;
const int max_n = 300011, log_n = 32, max_m = 111, mod = 1000000007,
          inf = 1011111111;
int n, a[max_n], m;
long long s;
int main() {
  cin >> n >> m;
  for (int i = 0; i < (1 << n); ++i) {
    scanf("%d", &a[i]);
    s += a[i];
  }
  for (int i = 0; i <= m; ++i) {
    printf("%.12f\n", 1.0 * s / (1 << n));
    int x, y;
    if (i == m) continue;
    scanf("%d%d", &x, &y);
    s -= a[x] - y;
    a[x] = y;
  }
  return 0;
}
