#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const long long mod = 1e9 + 7;
typedef struct Query {
  long long t, d;
  int id;
  friend bool operator<(Query a, Query b) { return a.t < b.t; }
} Query;
Query q[maxn];
queue<Query> Q;
int n, b;
long long ret[maxn];
int main() {
  cin >> n >> b;
  long long nxt = 0;
  for (int i = 0; i < n; i++) {
    scanf("%I64d%I64d", &q[i].t, &q[i].d);
    q[i].id = i;
    while (!Q.empty() && nxt <= q[i].t) {
      Query u = Q.front();
      Q.pop();
      nxt = max(nxt, u.t) + u.d;
      ret[u.id] = nxt;
    }
    if (nxt <= q[i].t && Q.empty()) {
      nxt = max(q[i].t, nxt) + q[i].d;
      ret[q[i].id] = nxt;
    } else {
      if (Q.size() < b)
        Q.push(q[i]);
      else
        ret[q[i].id] = -1;
    }
  }
  while (!Q.empty()) {
    Query u = Q.front();
    Q.pop();
    nxt = max(nxt, u.t) + u.d;
    ret[u.id] = nxt;
  }
  for (int i = 0; i < n; i++) printf("%I64d ", ret[i]);
  printf("\n");
  return 0;
}
