#include <bits/stdc++.h>
using namespace std;
int N, K;
long long Time;
int Free;
multiset<long long> Working;
int main() {
  scanf("%d%d", &N, &K);
  Free = K;
  Time = 0;
  long long S, M;
  for (int i = 0; i < N; ++i) {
    scanf("%I64d%I64d", &S, &M);
    S = max(S, Time);
    if (Free > 0) {
      --Free;
      printf("%I64d\n", S + M);
      Working.insert(S + M);
      Time = S;
    } else {
      Time = *Working.begin();
      Time = max(Time, S);
      printf("%I64d\n", Time + M);
      Working.erase(Working.begin());
      Working.insert(Time + M);
    }
    while ((not Working.empty()) and ((*Working.begin()) <= Time)) {
      ++Free;
      Working.erase(Working.begin());
    }
  }
  return 0;
}
