#include <bits/stdc++.h>
using namespace std;
int N, B;
int main() {
  scanf("%d%d", &N, &B);
  long long last_time = 0;
  int busy = 0;
  queue<long long> finish;
  for (int i = 0; i < (N); ++i) {
    long long t, d;
    scanf("%I64d%I64d", &t, &d);
    while (!finish.empty() && finish.front() <= t) {
      --busy;
      finish.pop();
    }
    if (t < last_time) {
      if (busy < B) {
        ++busy;
        finish.push(last_time);
        last_time += d;
        printf("%I64d", last_time);
      } else
        printf("-1");
    } else {
      last_time = t + d;
      printf("%I64d", last_time);
    }
    printf("%c", " \n"[i == N - 1]);
  }
  return 0;
}
