#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
const double EPS = 1e-9;
int main() {
  ios_base::sync_with_stdio(0);
  priority_queue<long long> q;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) q.push(-1);
  for (int i = 0; i < n; i++) {
    long long m, t;
    cin >> m >> t;
    long long w = max(m, -q.top());
    q.pop();
    cout << w + t << endl;
    q.push(-w - t);
  }
  return 0;
}
