#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long expo(long long base, long long pow) {
  long long ans = 1;
  while (pow != 0) {
    if (pow & 1 == 1) {
      ans = ans * base;
      ans = ans % mod;
    }
    base *= base;
    base %= mod;
    pow /= 2;
  }
  return ans;
}
long long inv(long long x) { return expo(x, mod - 2); }
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int M = 2e6 + 5;
long long arr[M];
int main() {
  int n;
  long long r;
  cin >> n >> r;
  long long summ = 0;
  long long tot = (1LL << n);
  for (int i = 0; i < (1 << n); i++) {
    scanf("%lld", &(arr[i]));
    summ += arr[i];
  }
  double ex = (summ * 1.0) / tot;
  printf("%.10f\n", ex);
  for (int i = 1; i <= r; i++) {
    int here;
    long long val;
    scanf("%d", &(here));
    scanf("%lld", &(val));
    summ -= arr[here];
    summ += val;
    arr[here] = val;
    ex = (summ * 1.0) / tot;
    printf("%.10f\n", ex);
  }
}
