#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  priority_queue<long long, vector<long long>, greater<long long>> q;
  for (int i = 0; i < k; i++) {
    q.push(0);
  }
  for (int i = 0; i < n; i++) {
    long long s, m;
    cin >> s >> m;
    long long t = q.top();
    q.pop();
    long long finish_time = max(s, t) + m;
    cout << finish_time << endl;
    q.push(finish_time);
  }
}
