#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
ifstream in_file("minta/be1.txt");
#define input in_file
#define INTHENAMEOFGOD
#else
#define input cin
#define INTHENAMEOFGOD \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#endif
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef array<ll, 2> all;
struct segment {
ll len, val;
};
vector<segment> tree;
ll N, M, a, b;
void set_node(ll ind, ll val) {
tree[ind-1].len = val;
ll curr = ind/2;
while (curr > 0) {
tree[curr-1].val = max(
tree[curr*2-1].len + tree[curr*2-1].val,
tree[curr*2].len + tree[curr*2].val
);
curr /= 2;
}
}
int main() {
INTHENAMEOFGOD
input >> N >> M;
for (ll n = 0; n < N; n++) {
for (ll i = 0; i < 1 << n; i++) {
tree.push_back((segment) {
.len = 1,
.val = N-n-1,
});
}
}
for (ll m = 0; m < M; m++) {
input >> a >> b;
set_node(a, b);
cout << tree[0].val << "\n";
}
}