#include <bits/stdc++.h>
using namespace std;
long long n, b, t, d, now;
queue<long long> q;
int main() {
  scanf("%lld%lld", &n, &b);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &t, &d);
    while (q.size() && q.front() <= t) {
      q.pop();
    }
    if (q.size() == 0) {
      now = t;
    }
    if (q.size() <= b) {
      now += d;
      cout << now << " ";
      q.push(now);
    } else
      cout << "-1 ";
  }
  return 0;
}
