#include <bits/stdc++.h>
using namespace std;
int n, b, t[200010], d[200010];
long long res[200010];
queue<int> q;
int main() {
  int i, j, k;
  while (scanf("%d%d", &n, &b) != EOF) {
    for (i = 1; i <= n; i++) {
      scanf("%d%d", &t[i], &d[i]);
    }
    printf("%d", t[1] + d[1]);
    while (!q.empty()) q.pop();
    long long ed = t[1] + d[1];
    for (i = 2; i <= n; i++) {
      if (q.size() < b) {
        q.push(i);
      } else {
        while (!q.empty() && ed <= t[i]) {
          int now = q.front();
          q.pop();
          ed = max(ed, t[now] + 0LL) + 0LL + d[now];
          res[now] = ed;
        }
        if (q.size() < b) {
          q.push(i);
        } else {
          res[i] = -1;
        }
      }
    }
    while (!q.empty()) {
      int now = q.front();
      q.pop();
      ed = max(ed, t[now] + 0LL) + 0LL + d[now];
      res[now] = ed;
    }
    for (i = 2; i <= n; i++) {
      cout << " " << res[i];
    }
    printf("\n");
  }
  return 0;
}
