#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
const double eps = 1e-10;
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
const long long N = 2e5 + 5;
const long long MOD = 1e9 + 7;
long long pw(long long b, long long p) {
  b %= MOD;
  long long res = 1;
  while (p > 0) {
    if (p & 1) res = res * b % MOD;
    b = b * b % MOD;
    p >>= 1;
  }
  return res;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, b, r;
  cin >> n >> b;
  vector<pair<long long, long long>> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  vector<long long> v, ans;
  v.push_back(a[0].first + a[0].second);
  ans.push_back(v.back());
  for (long long i = 1; i < n; i++) {
    if (a[i].first > v.back()) {
      v.push_back(a[i].first + a[i].second);
      ans.push_back(v.back());
    } else {
      if (v[0] > a[i].first)
        r = 0;
      else
        r = upper_bound(v.begin(), v.end(), a[i].first) - v.begin();
      if (v.size() - r > b)
        ans.push_back(-1);
      else {
        v.push_back(v.back() + a[i].second);
        ans.push_back(v.back());
      }
    }
  }
  for (auto i : ans) {
    cout << i << ' ';
  }
  return 0;
}
