#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  long long int n, b;
  cin >> n >> b;
  queue<long long int> q1;
  long long int time = 0;
  for (long long int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    while (!q1.empty() && x >= q1.front()) {
      q1.pop();
    }
    if (time <= x) {
      time = x + y;
      cout << time << " ";
    } else {
      if (q1.size() < b) {
        q1.push(time);
        time += y;
        cout << time << " ";
      } else {
        cout << "-1 ";
      }
    }
  }
  return 0;
}
