#include <bits/stdc++.h>
bool fncomp(char lhs, char rhs) { return lhs < rhs; }
int dbg = 0;
int stealth_debug = 0;
unsigned long long int max_sum;
int main() {
  int N, K;
  std::cin >> N;
  std::cin >> K;
  dbg&& std::cout << "N, K: " << N << " " << K << std::endl;
  std::set<std::tuple<unsigned long long int, unsigned long long int> > servers;
  std::vector<unsigned long long int> S(N);
  std::vector<unsigned long long int> M(N);
  std::vector<unsigned long long int> E(N);
  for (int i = 0; i < N; i++) {
    std::cin >> S[i];
    std::cin >> M[i];
  }
  for (int i = 0; i < N; i++) {
    unsigned long long int max = 0;
    if (servers.size() < K) {
      max = S[i];
      unsigned long long int e = max + M[i];
      servers.emplace(
          std::tuple<unsigned long long int, unsigned long long int>(
              e, servers.size()));
      E[i] = e;
    } else {
      auto m = servers.begin();
      max = std::max(std::get<0>(*m), S[i]);
      auto si = std::get<1>(*m);
      servers.erase(m);
      unsigned long long int e = max + M[i];
      servers.emplace(
          std::tuple<unsigned long long int, unsigned long long int>(e, si));
      E[i] = e;
    }
  }
  if (stealth_debug) {
    dbg = 1;
  }
  std::stringstream buffer;
  for (auto& x : E) {
    buffer << x << std::endl;
  }
  std::cout << buffer.str();
  return 0;
}
