#include <bits/stdc++.h>
using namespace std;
const int N = 5e5;
int q[N];
int qr[N];
int t[N];
long long ans[N];
int main() {
  int n, b;
  scanf("%d%d", &n, &b);
  for (int i = 0; i < n; i++) {
    scanf("%d", &qr[i]);
    scanf("%d", &t[i]);
  }
  memset(ans, -1, sizeof ans);
  int qs = 0, qe = 0;
  int pos = 0;
  long long now = 0;
  while (pos <= n) {
    if (qs < qe) {
      now = max(now, (long long)qr[q[qs]]) + t[q[qs]];
      ans[q[qs]] = now;
      qs++;
    }
    if (pos == n) {
      if (qs == qe) {
        break;
      } else {
        continue;
      }
    }
    while (pos < n && (long long)qr[pos] < now) {
      if (qe - qs < b) {
        q[qe] = pos;
        qe++;
      }
      pos++;
    }
    if (pos < n && qe - qs == 0) {
      q[qe] = pos;
      qe++;
      pos++;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%I64d ", ans[i]);
  }
  puts("");
  return 0;
}
