#include <bits/stdc++.h>
using namespace std;
int n, siz;
struct query {
  long long t, d;
} a[200001];
queue<int> q;
long long ans[200001];
int main() {
  scanf("%d%d", &n, &siz);
  long long time = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &a[i].t, &a[i].d);
  }
  while (!q.empty()) q.pop();
  for (int i = 1; i <= n; i++) {
    while (!q.empty()) {
      int f = q.front();
      if (time <= a[i].t) {
        ans[f] = max(time, a[f].t) + a[f].d;
        time = max(time, a[f].t) + a[f].d;
        q.pop();
      } else
        break;
    }
    if (time <= a[i].t && q.empty()) {
      time = a[i].t + a[i].d;
      ans[i] = a[i].t + a[i].d;
      continue;
    }
    if (q.size() < siz)
      q.push(i);
    else
      ans[i] = -1;
  }
  while (!q.empty()) {
    int f = q.front();
    ans[f] = max(time, a[f].t) + a[f].d;
    time = max(time, a[f].t) + a[f].d;
    q.pop();
  }
  for (int i = 1; i <= n - 1; i++) printf("%lld ", ans[i]);
  printf("%lld", ans[n]);
  return 0;
}
