#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
long long int a, b, i, j, k, n, m, timer = 0, l, r, x, y;
long long int cnt = 0, fl = 0, a2, a3 = -1000000, ans = 0;
set<pair<long long int, long long int> > st;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  x = 0;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    while (st.size() > 0 && (*st.begin()).first <= a) {
      st.erase(st.begin());
      x--;
    }
    if (x != k)
      cout << a + b << endl;
    else {
      a = (*st.begin()).first;
      st.erase(st.begin());
      x--;
      cout << a + b << endl;
    }
    st.insert(make_pair(a + b, i));
    x++;
  }
  return 0;
}
