#include <bits/stdc++.h>
using namespace std;
multiset<long long> q;
void printwithspace(long long nr, bool &fst) {
  if (!fst) cout << " ";
  cout << nr;
  fst = false;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, b, st, dur;
  cin >> n >> b;
  bool fst = true;
  for (int i = 0; i < n; ++i) {
    cin >> st >> dur;
    auto it = q.begin();
    while (it != q.end()) {
      auto cur = it++;
      if (*cur <= st)
        q.erase(cur);
      else
        break;
    }
    if (q.size() == b + 1) {
      printwithspace(-1, fst);
      continue;
    }
    long long fn = (q.empty() ? (st * 1LL) : *q.rbegin()) + dur;
    printwithspace(fn, fst);
    q.insert(fn);
  }
  cout << "\n";
  return 0;
}
