#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  pair<long long, long long> p[n];
  priority_queue<long long> qu;
  long long int a[n];
  long long int maxi;
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  for (int i = 0; i < k; i++) {
    qu.push(0);
  }
  for (int i = 0; i < n; i++) {
    maxi = max(p[i].first, -qu.top()) + p[i].second;
    a[i] = maxi;
    qu.pop();
    qu.push(-maxi);
    cout << a[i] << endl;
  }
  return 0;
}
