#include <bits/stdc++.h>
using namespace std;
long long read() {
  char ch = ' ';
  long long x = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x;
}
priority_queue<long long, vector<long long>, greater<long long> > q;
void Solve() {
  long long n = read(), k = read();
  for (int i = 0; i < n; i++) {
    long long s = read(), m = read();
    if (q.size() < k) {
      printf("%I64d\n", s + m);
      q.push(s + m);
    } else {
      long long t = q.top();
      q.pop();
      printf("%I64d\n", max(s, t) + m);
      q.push(max(s, t) + m);
    }
  }
}
int main() {
  Solve();
  return 0;
}
