#include <bits/stdc++.h>
using namespace std;
typedef struct lol {
  int t, d;
} troll;
int i, n, st = 1, dr, b, q[200005];
troll a[200005];
long long rs[200005], curr;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> b;
  for (i = 1; i <= n; ++i) cin >> a[i].t >> a[i].d;
  for (i = 1; i <= n; ++i) {
    if (curr > a[i].t)
      if (dr - st + 1 < b)
        q[++dr] = i;
      else
        rs[i] = -1;
    else if (st > dr)
      curr = a[i].t + a[i].d, rs[i] = curr;
    else {
      while (st <= dr && curr + a[q[st]].d <= a[i].t)
        curr += a[q[st]].d, rs[q[st]] = curr, ++st;
      if (st <= dr) curr += a[q[st]].d, rs[q[st]] = curr, ++st;
      curr = max(curr, 1LL * a[i].t);
      if (dr - st + 1 < b)
        q[++dr] = i;
      else
        rs[i] = -1;
    }
  }
  while (st <= dr) curr += a[q[st]].d, rs[q[st]] = curr, ++st;
  for (i = 1; i <= n; ++i) cout << rs[i] << " \n"[i == n];
  return 0;
}
