#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:66777216")
int n, k;
multiset<long long> s;
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  for (int i = 0; i < (k); ++i) s.insert(0);
  int t, len;
  long long tcur;
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &t);
    scanf("%d", &len);
    tcur = *s.begin();
    tcur = max((long long)t, tcur) + (long long)len;
    cout << tcur << endl;
    s.erase(s.begin());
    s.insert(tcur);
  }
}
