#include <bits/stdc++.h>
using namespace std;
long long a[1000005], n, k, x, y, sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < (1 << n); sum += a[i++]) cin >> a[i];
  for (; cout << fixed << setprecision(12) << sum * 1.0 / (1 << n) << '\n' &&
         k--;) {
    cin >> y >> x;
    sum -= a[y] - x;
    a[y] = x;
  }
}
