#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return (a > b); }
priority_queue<long long, vector<long long>, greater<long long> > data;
int main() {
  int n, k, x, y;
  long long a, b, ans;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &x, &y);
    a = x;
    b = y;
    if (i <= k)
      data.push(a + b), printf("%I64d\n", a + b);
    else {
      ans = max(a, data.top()) + b;
      data.pop();
      data.push(ans);
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
