#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
void solve() {
  int n, r;
  cin >> n >> r;
  int n2 = 1 << n;
  vector<int> f(n2);
  for (int i = 0; i < n2; ++i) cin >> f[i];
  long long sum = 0;
  for (int i = 0; i < n2; ++i) sum += f[i];
  cout << (sum / n2) << endl;
  while (r-- > 0) {
    int z, g;
    cin >> z >> g;
    sum += (g - f[z]);
    f[z] = g;
    cout << (1.0 * sum / n2) << endl;
  }
}
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  return 0;
}
