#include <bits/stdc++.h>
const long long MOD = 1000000007;
const long long inf = 1e18;
using namespace std;
long long int modpow(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
long long int power(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
long long int sq(long long int x1, long long int y1) {
  return x1 * x1 + y1 * y1;
}
void always_ignore_function_name() {
  int n, q;
  cin >> n >> q;
  std::vector<long long int> v(1 << n);
  long double a = 0;
  for (int i = 0; i < (1 << n); i++) {
    cin >> v[i];
    a += v[i];
  }
  cout << setprecision(10) << a / (1 << n) << endl;
  while (q--) {
    int x, y;
    cin >> x >> y;
    a += y - v[x];
    v[x] = y;
    cout << setprecision(10) << a / (1 << n) << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int t = 1, tt = 1;
  while (tt <= t) {
    always_ignore_function_name();
    tt++;
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
