#include <bits/stdc++.h>
using namespace std;
typedef struct {
  long long num, st, end;
} TVertex;
int main() {
  int n, b;
  cin >> n >> b;
  queue<TVertex> q;
  vector<long long> ans(n);
  long long cend = 0;
  for (int i = 0; i < n; ++i) {
    long long t, d;
    cin >> t >> d;
    while (!q.empty() && q.front().end <= t) {
      q.pop();
    }
    long long sz = q.size();
    if (!q.empty() && q.front().st <= t) {
      --sz;
    }
    if (q.empty()) {
      cend = 0;
    }
    TVertex nw;
    nw.num = i;
    nw.st = max(cend, t);
    if (sz < b) {
      cend = nw.st + d;
      nw.end = cend;
      ans[i] = cend;
      q.push(nw);
    } else {
      ans[i] = -1;
    }
  }
  for (int i = 0; i < (int)ans.size(); ++i) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
