#include <bits/stdc++.h>
using namespace std;
int n, m, num[(1 << 20)];
long long sum1;
double ans;
int main() {
  scanf("%d%d", &n, &m);
  int sum = 1;
  for (int i = 1; i <= n; i++) sum *= 2;
  for (int i = 1; i <= sum; i++) {
    scanf("%d", &num[i]);
    sum1 += num[i];
  }
  ans = sum1 * 1.0 / sum;
  printf("%.6lf\n", ans);
  for (int i = 1; i <= m; i++) {
    int a1, a2;
    scanf("%d%d", &a1, &a2);
    sum1 = sum1 - num[a1 + 1] + a2;
    num[a1 + 1] = a2;
    ans = sum1 * 1.0 / sum;
    printf("%.6lf\n", ans);
  }
  return 0;
}
