#include <bits/stdc++.h>
using namespace std;
struct Query;
struct Query {
  Query() { clean(); }
  Query(uint64_t _time, uint64_t _duration)
      : time(_time), duration(_duration), valid(true) {}
  static Query read() {
    uint64_t t, d;
    cin >> t >> d;
    return Query(t, d);
  }
  uint64_t finishTime() { return time + duration; }
  void clean() {
    time = 0;
    duration = 0;
    valid = false;
  }
  void setInvalid() { valid = false; }
  bool isValid() { return valid; }
  uint64_t time, duration;
  bool valid;
};
ostream &operator<<(ostream &stream, const Query &q) {
  stream << "(" << q.time << ", " << q.duration << ")";
  return stream;
}
void skipInvalid(queue<Query> &q) {
  while (!q.empty() && !q.front().isValid()) {
    cout << -1 << " ";
    q.pop();
  }
}
void updateQueue(queue<Query> &q, uint64_t &queueSize, uint64_t time) {
  while (!q.empty()) {
    if (q.front().isValid()) {
      if (q.front().finishTime() <= time) {
        uint64_t finishTime = q.front().finishTime();
        cout << finishTime << " ";
        q.pop();
        queueSize--;
        skipInvalid(q);
        q.front().time = finishTime;
      } else {
        break;
      }
    } else {
      cout << -1 << " ";
      q.pop();
    }
  }
}
int main(int argc, const char *argv[]) {
  uint64_t count, size;
  cin >> count >> size;
  vector<Query> data;
  for (uint64_t i = 0; i < count; i++) {
    data.push_back(Query::read());
  }
  uint64_t queueSize = 0;
  queue<Query> q;
  for (auto el : data) {
    updateQueue(q, queueSize, el.time);
    if (queueSize > size) {
      el.setInvalid();
    }
    if (el.isValid()) {
      queueSize++;
    }
    q.push(el);
  }
  while (!q.empty()) {
    auto finishTime = q.front().finishTime();
    cout << finishTime << " ";
    q.pop();
    skipInvalid(q);
    q.front().time = finishTime;
  }
  return 0;
}
