#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, b, t, d;
  cin >> n >> b;
  vector<pair<int, int> > queries(n);
  for (int i = 0; i < n; i++) {
    cin >> t >> d;
    queries[i] = make_pair(t, d);
  }
  vector<long long> result(n, -1);
  vector<long long> finish_time;
  int queue_size = 0, current_query = 0;
  for (int i = 0; i < n; i++) {
    t = queries[i].first, d = queries[i].second;
    if (current_query < finish_time.size() && t < finish_time[current_query]) {
      if (queue_size < b) {
        queue_size++;
        result[i] = finish_time.back() + d;
        finish_time.push_back(result[i]);
      } else {
        result[i] = -1;
      }
    } else {
      if (queue_size == 0) {
        if (current_query < finish_time.size()) {
          ++current_query;
        }
        result[i] = (long long)t + d;
        finish_time.push_back(result[i]);
      } else {
        queue_size--;
        current_query++;
        i--;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << result[i] << " ";
  }
  return 0;
}
