#include <bits/stdc++.h>
using namespace std;
vector<int> pset[3];
void initSet(int N, int ind) {
  pset[ind].assign(N, 0);
  for (int i = 0; i < N; i++) pset[ind][i] = i;
}
int findSet(int i, int ind) {
  return (pset[ind][i] == i) ? i : (pset[ind][i] = findSet(pset[ind][i], ind));
}
bool isSameSet(int i, int j, int ind) {
  return findSet(i, ind) == findSet(j, ind);
}
void unionSet(int i, int j, int ind) {
  pset[ind][findSet(i, ind)] = findSet(j, ind);
}
int main() {
  int n, b;
  cin >> n >> b;
  vector<pair<int, int> > queries;
  for (int i = 0; i < n; i++) {
    int start, duration;
    cin >> start >> duration;
    queries.push_back(make_pair(start, duration));
  }
  queue<int> q;
  long long time = queries[0].first;
  int ind = 1;
  long long time_end = time + queries[0].second;
  vector<unsigned long long> ans(n, 0);
  ans[0] = time_end;
  int ind_ans = 1;
  while (true) {
    while (ind < n && queries[ind].first < time_end) {
      if (q.size() < b)
        q.push(queries[ind].second);
      else
        ans[ind] = (long long)1e16;
      ind++;
    }
    time = time_end;
    if (q.empty()) {
      if (ind == n) break;
      time = queries[ind].first;
      time_end = time + queries[ind].second;
      ans[ind] = time_end;
      ind++;
    } else {
      time_end = time + q.front();
      while (ans[ind_ans] != 0) ind_ans++;
      ans[ind_ans] = time_end;
      q.pop();
    }
  }
  for (int i = 0; i < n; i++)
    if (ans[i] == (long long)1e16)
      cout << -1 << " ";
    else
      cout << ans[i] << " ";
  return 0;
}
