#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  long long int s[n], m[n];
  multiset<long long int> a;
  for (int i = 0; i < n; i++) {
    cin >> s[i] >> m[i];
  }
  for (int i = 0; i < k; i++) {
    cout << s[i] + m[i] << endl;
    a.insert(s[i] + m[i]);
  }
  for (int i = k; i < n; i++) {
    int l = a.size();
    cout << max(s[i], 1ll * *a.begin()) + m[i] << endl;
    a.insert(max(s[i], 1ll * *a.begin()) + m[i]);
    a.erase(a.begin());
  }
}
