#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const signed long long int LINF = LLONG_MAX;
const double EPS = 1e-9;
const int MOD = 1000000007;
const int MAXN = 100001;
const int ALPH = 26;
const int DALPH = 52;
int n, k;
int main() {
  scanf("%d %d", &n, &k);
  priority_queue<signed long long int> Q;
  for (int i = 0; i < n; ++i) {
    signed long long int s, m;
    scanf("%I64d %I64d", &s, &m);
    while (!Q.empty() && -Q.top() <= s) {
      Q.pop();
    }
    if ((int)(Q).size() == k) {
      s = -Q.top();
      Q.pop();
    }
    signed long long int endTime = s + m;
    Q.push(-endTime);
    printf("%I64d\n", endTime);
  }
}
