#include <bits/stdc++.h>
using namespace std;
queue<long long> q;
long long n, b, t, d, ans = 0;
int main() {
  scanf("%d%d", &n, &b);
  while (n--) {
    cin >> t >> d;
    while (q.size() && q.front() <= t) q.pop();
    if (q.empty()) ans = t;
    if (q.size() <= b) {
      ans += d;
      q.push(ans);
      cout << ans << " ";
    } else
      printf("-1 ");
  }
  printf("\n");
  return 0;
}
