#include <bits/stdc++.h>
using namespace std;
int main() {
  clock_t start = clock();
  int n, k;
  while (scanf("%d%d", &n, &k) == 2) {
    vector<int> st(n), dt(n);
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &st[i], &dt[i]);
    }
    multiset<long long> ft;
    vector<long long> answer(n);
    for (int i = 0; i < n; i++) {
      while (!ft.empty() && *ft.begin() <= st[i]) {
        k++;
        ft.erase(ft.begin());
      }
      if (k > 0) {
        answer[i] = st[i] + dt[i];
        k--;
        ft.insert(answer[i]);
      } else {
        assert(!ft.empty());
        long long first = *ft.begin();
        ft.erase(ft.begin());
        answer[i] = first + dt[i];
        ft.insert(answer[i]);
      }
    }
    for (int i = 0; i < n; i++) {
      printf("%lld\n", answer[i]);
    }
    puts("");
  }
  42;
  ;
  return 0;
}
