#include <bits/stdc++.h>
using namespace std;
long long a, b, n, i, t, d, ans[200001], cur_time;
queue<int> q;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> b;
  for (; i < n; ++i) {
    cin >> t >> d;
    while (!q.empty() && t >= q.front()) q.pop();
    if (q.size() >= b) {
      ans[i] = -1;
      continue;
    }
    cur_time = max(cur_time, 1LL * t);
    q.push(cur_time);
    cur_time += d;
    ans[i] = cur_time;
  }
  for (i = 0; i < n; ++i) cout << ans[i] << ' ';
  return 0;
}
