#include <bits/stdc++.h>
using namespace std;
long long ans[200001];
int main() {
  int n, b;
  queue<pair<long long, long long> > q;
  cin >> n >> b;
  long long ls = 0;
  for (int i = 0; i < n; i++) {
    long long t, d;
    cin >> t >> d;
    while (!q.empty() && ls + q.front().second <= t) {
      ls = ls + q.front().second;
      ans[q.front().first] = ls;
      q.pop();
    }
    if (q.empty()) {
      ls = t;
      q.push(make_pair(i, d));
    } else if (q.size() <= b) {
      q.push(make_pair(i, d));
    } else {
      ans[i] = -1;
    }
  }
  while (!q.empty()) {
    ls = ls + q.front().second;
    ans[q.front().first] = ls;
    q.pop();
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
