#include <bits/stdc++.h>
using namespace std;
long long n, b, t, d, ans;
queue<long long> q;
int main() {
  cin >> n >> b;
  while (n--) {
    cin >> t >> d;
    while (q.size() && q.front() <= t) q.pop();
    if (q.empty()) ans = t;
    if (q.size() <= b)
      ans += d, q.push(ans), cout << ans << ' ';
    else
      cout << -1 << ' ';
  }
  return 0;
}
