#include <bits/stdc++.h>
int main() {
  int nmovies, nservers;
  std::cin >> nmovies >> nservers;
  std::priority_queue<long long, std::vector<long long>,
                      std::greater<long long>>
      heap;
  std::vector<long long> results(nmovies);
  int straight_away_processed = std::min(nmovies, nservers);
  for (int i = 0; i < straight_away_processed; ++i) {
    int begin, length;
    std::cin >> begin >> length;
    int end = begin + length;
    results[i] = end;
    heap.push(end);
  }
  for (int i = straight_away_processed; i < nmovies; ++i) {
    long long begin, end;
    int length;
    std::cin >> begin >> length;
    long long server_ready = heap.top();
    heap.pop();
    if (server_ready < begin) {
      end = begin + length;
    } else {
      end = server_ready + length;
    }
    results[i] = end;
    heap.push(end);
  }
  for (long long result : results) {
    std::cout << result << '\n';
  }
  return EXIT_SUCCESS;
}
