#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long> > Q;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) Q.push(0LL);
  long long s, t;
  for (int i = 0; i < n; i++) {
    cin >> s >> t;
    long long x = Q.top();
    Q.pop();
    if (x < s) {
      cout << s + t << endl;
      Q.push(s + t);
    } else {
      cout << x + t << endl;
      Q.push(x + t);
    }
  }
  return 0;
}
