#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
int n, b;
queue<pair<int, int> > q;
long long ans[MAXN];
int main() {
  scanf("%d%d", &n, &b);
  long long available = 0;
  memset(ans, 0xff, sizeof ans);
  for (int i = 0, t, d; i < n; ++i) {
    scanf("%d%d", &t, &d);
    while (!q.empty() && available <= t) {
      ans[q.front().first] = available += q.front().second;
      q.pop();
    }
    available = max(available, (long long)t);
    if ((int)q.size() < b) {
      q.push(make_pair(i, d));
    }
  }
  while (!q.empty()) {
    ans[q.front().first] = available += q.front().second;
    q.pop();
  }
  for (int i = 0; i < n; ++i) {
    printf("%lld%c", ans[i], " \n"[i + 1 == n]);
  }
  return 0;
}
