#include <bits/stdc++.h>
using namespace std;
long long n, k, x, y;
priority_queue<long long, vector<long long>, greater<long long> > q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  while (n--) {
    cin >> x >> y;
    if (q.size() < k) {
      cout << x + y << endl;
      q.push(x + y);
    } else {
      long long p = q.top();
      q.pop();
      p = max(p, x);
      cout << p + y << endl;
      q.push(p + y);
    }
  }
  return 0;
}
