#include <bits/stdc++.h>
using namespace std;
int main() {
  long long tp = 0, b, n, m;
  long long ti, di, i = 0;
  queue<long long> t;
  scanf("%I64d %I64d", &n, &b);
  m = n;
  while (n--) {
    scanf("%I64d %I64d", &ti, &di);
    while (t.size() && t.front() <= ti) t.pop();
    if (t.size() == 0) tp = ti;
    if (t.size() <= b) {
      tp += di;
      t.push(tp);
      printf("%I64d ", tp);
    } else
      printf("-1 ");
    printf("\n");
  }
  return 0;
}
