#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tt = 1;
  while (tt--) {
    long long n, b;
    cin >> n >> b;
    long long t[n], d[n], sum = 0, server = 0, idx = 0, ans[n], cur;
    queue<long long> que;
    for (int i = 0; i < n; i++) {
      cin >> t[i] >> d[i];
    }
    cur = t[0];
    for (int i = 0; i < n; i++) {
      cur = max(cur, t[i]);
      if (t[i] <= cur) {
        if (que.size() == b) {
          ans[i] = -1;
        } else {
          que.push(i);
        }
      }
      cur =
          max(cur, min((i == n - 1 ? 3000000000000000000 : t[i + 1]), server));
      while (server <= cur && que.empty() == 0) {
        long long tmp = que.front();
        que.pop();
        server = cur + d[tmp];
        ans[tmp] = cur + d[tmp];
        cur = max(cur,
                  min(server, (i == n - 1 ? 3000000000000000000 : t[i + 1])));
      }
    }
    cur = max(server, cur);
    while (que.empty() == 0) {
      long long tmp = que.front();
      que.pop();
      server = cur + d[tmp];
      ans[tmp] = cur + d[tmp];
      cur = max(server, cur);
    }
    for (int i = 0; i < n; i++) {
      cout << ans[i] << ' ';
    }
    cout << '\n';
  }
}
