#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> q;
int main() {
  long long n, k, s, m;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    scanf("%I64d%I64d", &s, &m);
    long long hamada = s + m;
    printf("%I64d\n", hamada);
    q.push(-hamada);
  }
  for (int i = 0; i < n - k; i++) {
    scanf("%I64d%I64d", &s, &m);
    s = max(s, -q.top()) + m;
    q.push(-s);
    q.pop();
    printf("%I64d\n", s);
  }
  return 0;
}
