#include <bits/stdc++.h>
using namespace std;
int n, k;
long long s, t, new_val, tmp;
multiset<long long> a;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k; ++i) {
    a.insert(0LL);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d%I64d", &s, &t);
    tmp = *a.begin();
    new_val = (tmp > s ? tmp + t : s + t);
    printf("%I64d\n", new_val);
    a.erase(a.begin());
    a.insert(new_val);
  }
  return 0;
}
