#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
int main() {
  scanf("%d%d", &n, &k);
  priority_queue<long long, std::vector<long long>, std::greater<long long>> q;
  q.push(0);
  long long e;
  for (int i = 0, s; i < n; i++) {
    scanf("%d%d", &s, &m);
    if (q.top() > s && q.size() < k) {
      e = (long long)s + m;
      q.push(e);
    } else {
      long long E = q.top();
      q.pop();
      if (E <= s)
        e = (long long)s + m;
      else
        e = E + m;
      q.push(e);
    }
    printf("%lld\n", e);
  }
  return 0;
}
