#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(0);
  int n, k;
  std::cin >> n >> k;
  std::multiset<long long> vbudke;
  for (int i(0); i < k; i++) {
    vbudke.insert(0);
  }
  long long s, m, lCurrentServer;
  for (int i(0); i < n; i++) {
    lCurrentServer = *vbudke.begin();
    vbudke.erase(vbudke.begin());
    std::cin >> s >> m;
    if (s > lCurrentServer) {
      lCurrentServer = s + m;
    } else {
      lCurrentServer += m;
    }
    std::cout << lCurrentServer << std::endl;
    vbudke.insert(lCurrentServer);
  }
  std::cin.get();
  std::cin.get();
  return 0;
}
