#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b, len = 0;
  long long cur1, cur2;
  scanf("%d%d", &n, &b);
  list<int> v;
  list<int>::iterator t;
  int x, y, ab[n], cd[n];
  scanf("%d%d", &x, &y);
  cur1 = x;
  cur2 = x + y;
  v.push_back(cur2);
  for (int i = 1; i < n; i++) scanf("%d%d", &ab[i], &cd[i]);
  printf("%I64d ", cur2);
  for (int i = 1; i < n; i++) {
    if (ab[i] >= cur2) {
      cur1 = ab[i];
      cur2 = ab[i] + cd[i];
      v.pop_front();
      v.push_back(cur2);
      printf("%I64d ", cur2);
    } else if (ab[i] < cur2) {
      if (len > 0) {
        t = v.begin();
        if (*t <= ab[i]) {
          v.pop_front();
          len--;
        }
      }
      if (len < b) {
        len++;
        cur2 += cd[i];
        v.push_back(cur2);
        printf("%I64d ", cur2);
      } else
        printf("%d ", -1);
    }
  }
  return 0;
}
