#include <bits/stdc++.h>
using namespace std;
const int maxn = 500100;
multiset<pair<long long, long long> > intervals;
long long n, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < k; i++) intervals.insert(make_pair(0, i));
  long long s, d;
  for (int i = 0; i < n; i++) {
    cin >> s >> d;
    auto x = intervals.begin();
    long long stx = (*x).first;
    long long idx = (*x).second;
    if (stx < s) stx = s;
    stx += d;
    cout << stx << "\n";
    intervals.erase(x);
    intervals.insert(make_pair(stx, idx));
  }
  return 0;
}
