#include <bits/stdc++.h>
int main() {
  long long int n, b, i, j, flag, moment[200005], time[200005], length,
      end_time[200005], end_time_flag, stack[200005], temp, hat;
  length = 0;
  scanf("%I64d %I64d ", &n, &b);
  scanf("%I64d %I64d", &moment[1], &time[1]);
  end_time[1] = moment[1] + time[1];
  end_time_flag = 1;
  stack[1] = end_time[1];
  temp = 2;
  hat = 1;
  printf("%I64d ", end_time[1]);
  for (i = 2; i <= n; i++) {
    scanf("%I64d %I64d", &moment[i], &time[i]);
    length++;
    for (; moment[i] >= stack[hat] && hat < temp;) {
      hat++;
      length--;
    }
    if (length <= b) {
      if (length == 0) {
        end_time[i] = moment[i] + time[i];
        stack[temp] = end_time[i];
        temp++;
        end_time_flag = i;
      } else {
        end_time[i] = end_time[end_time_flag] + time[i];
        stack[temp] = end_time[i];
        temp++;
        end_time_flag = i;
      }
      printf("%I64d ", end_time[i]);
    } else {
      printf("-1 ");
      length--;
    }
  }
  printf("\n");
  return 0;
}
