#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b;
  cin >> n >> b;
  ++b;
  queue<long long> q;
  vector<long long> t(n);
  vector<long long> d(n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i] >> d[i];
  }
  for (int i = 0; i < n; ++i) {
    while (q.size() && q.front() <= t[i]) {
      q.pop();
    }
    if (q.size() < b) {
      long long end = (q.size() ? q.back() : t[i]) + d[i];
      q.push(end);
      cout << end << " ";
    } else {
      cout << -1 << " ";
    }
  }
  cout << "\n";
  return 0;
}
