#include <bits/stdc++.h>
using namespace std;
template <typename T>
T next() {
  T tmp;
  cin >> tmp;
  return tmp;
}
int main() {
  int n = next<int>();
  int b = next<int>();
  vector<long long> t(n);
  vector<long long> d(n);
  for (int i = 0; i < n; ++i) {
    t[i] = next<long long>();
    d[i] = next<long long>();
  }
  vector<long long> ans(n, -1);
  vector<long long> delays;
  size_t beg = 0;
  for (size_t i = 0; i < t.size(); ++i) {
    while (beg < delays.size() && delays[beg] <= t[i]) {
      beg++;
    }
    if (delays.size() - beg == b + 1) {
      ans[i] = -1;
    } else if (delays.size() == beg) {
      delays.push_back(t[i] + d[i]);
      ans[i] = delays.back();
    } else {
      delays.push_back(delays.back() + d[i]);
      ans[i] = delays.back();
    }
  }
  for (size_t i = 0; i < ans.size(); ++i) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
