#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 2e6 + 220;
int n, k;
set<long long> s;
long long sec[MAX_N], m[MAX_N];
map<long long, long long> mp;
void Init() {
  cin >> n >> k;
  for (int i = 1; i < n + 1; i++) cin >> sec[i] >> m[i];
}
void Solve() {
  for (int i = 1; i < n + 1; i++) {
    if (i <= k) {
      cout << sec[i] + m[i] << endl;
      mp[sec[i] + m[i]]++;
      s.insert(sec[i] + m[i]);
      continue;
    }
    long long x = (*s.begin());
    if (x >= sec[i]) {
      mp[x]--;
      if (mp[x] == 0) s.erase(x);
      cout << x + m[i] << endl;
      s.insert(x + m[i]);
      mp[x + m[i]]++;
    } else {
      mp[x]--;
      if (mp[x] == 0) s.erase(x);
      cout << sec[i] + m[i] << endl;
      s.insert(sec[i] + m[i]);
      mp[sec[i] + m[i]]++;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  Init();
  Solve();
}
