#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> proc[200000];
int main() {
  int n, q;
  queue<pair<long long, long long> > que;
  cin >> n >> q;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq, ans;
  for (int i = 0; i < n; i++) {
    cin >> proc[i].first >> proc[i].second;
    pq.push(proc[i]);
  }
  long long will_exit = 0;
  while (!pq.empty()) {
    pair<long long, long long> moment = pq.top();
    pq.pop();
    if (moment.second == -1) {
      if (!que.empty()) {
        pair<long long, long long> r = que.front();
        que.pop();
        will_exit = moment.first + r.second;
        ans.push(pair<long long, long long>(r.first, will_exit));
        pq.push(pair<long long, long long>(will_exit, -1));
      }
    } else {
      if (will_exit <= moment.first) {
        will_exit = moment.first + moment.second;
        ans.push(pair<long long, long long>(moment.first, will_exit));
        pq.push(pair<long long, long long>(will_exit, -1));
      } else if (que.size() < q) {
        que.push(moment);
      } else {
        ans.push(pair<long long, long long>(moment.first, -1));
      }
    }
  }
  while (!ans.empty()) {
    pair<long long, long long> f = ans.top();
    ans.pop();
    cout << f.second << " ";
  }
  cout << endl;
}
