#include <bits/stdc++.h>
using namespace std;
multiset<long long> s;
pair<long long, long long> a[1111111];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = make_pair(x, y);
  }
  sort(a, a + n);
  for (int i = 0; i < k; i++) s.insert(0);
  for (int i = 0; i < n; i++) {
    multiset<long long>::iterator it = s.begin();
    s.erase(s.begin());
    long long x = (*it);
    if (a[i].first >= x) x = a[i].first;
    printf("%lld\n", x + a[i].second);
    s.insert(x + a[i].second);
  }
  return 0;
}
