#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b;
  cin >> n >> b;
  b++;
  long long t, d, ans[200002];
  vector<long long> v;
  for (int k = 0; k < n; ++k) {
    cin >> t >> d;
    while (!v.empty() && v[0] <= t) v.erase(v.begin());
    if (v.size() < b) {
      if (v.empty()) {
        v.push_back(t + d);
      } else {
        v.push_back(v[v.size() - 1] + d);
      }
      ans[k] = v[v.size() - 1];
    } else {
      ans[k] = -1;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
