#include <bits/stdc++.h>
using namespace std;
deque<long long> d;
int n, m;
long long t, p, cur;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d%I64d", &t, &p);
    while (!d.empty() && d.front() <= t) {
      d.pop_front();
    }
    if (d.size() == m + 1) {
      printf("-1 ");
    } else {
      cur = max(cur, t);
      cur += p;
      d.push_back(cur);
      printf("%I64d ", cur);
    }
  }
}
