#include <bits/stdc++.h>
using namespace std;
queue<long long int> q;
long long int n, b, t[600000], d[600000], f = 0, p = 0, a[600000], k = 0;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> b;
  for (int i = 1; i <= n; i++) {
    cin >> t[i] >> d[i];
    if (f == 1) {
      while (!q.empty() && p <= t[i]) {
        p = q.front();
        q.pop();
      }
      if (q.size() < b) {
        k += d[i];
        t[i] += d[i];
        k = max(k, t[i]);
        a[i] = k;
        q.push(k);
      } else
        a[i] = -1;
    } else {
      f = 1;
      k = 0;
      a[i] = t[i] + d[i];
      p = a[i];
      k = a[i];
    }
  }
  for (int i = 1; i <= n; i++) cout << a[i] << ' ';
  return 0;
}
