#include <bits/stdc++.h>
using namespace std;
int n, b;
long long t[200005], d[200005], ans[200005];
int rej[200005];
int main(int argc, char const *argv[]) {
  scanf("%d%d", &n, &b);
  for (int i = 0; i < n; ++i) {
    scanf("%I64d%I64d", t + i, d + i);
  }
  d[n] = t[n] = 1000000000ll * 2000000;
  int l = 0, job = 0;
  long long lb = 0;
  for (int r = 0; r < n + 1; ++r) {
    while (r > l) {
      if (!rej[l] && max(lb, t[l]) + d[l] > t[r]) break;
      if (!rej[l]) {
        ans[l] = max(lb, t[l]) + d[l];
        lb = ans[l];
        job--;
      }
      l++;
    }
    if (job > b) {
      rej[r] = 1;
      ans[r] = -1;
    } else {
      job++;
    }
  }
  for (int i = 0; i < n; ++i) printf("%I64d%c", ans[i], i < n - 1 ? ' ' : '\n');
  return 0;
}
