#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
int n, b;
long long poc[MAXN], len[MAXN];
vector<long long> ans, seg;
int main() {
  scanf("%d %d", &n, &b);
  for (int i = 0; i < n; i++) scanf("%I64d %I64d", &poc[i], &len[i]);
  seg.push_back(poc[0] + len[0]);
  ans.push_back(poc[0] + len[0]);
  long long last = poc[0] + len[0];
  for (int i = 1; i < n; i++) {
    int pos = lower_bound(seg.begin(), seg.end(), poc[i]) - seg.begin();
    int oduzmi = 0;
    if (seg[pos] == poc[i]) oduzmi = 1;
    int cnt = (int)seg.size() - pos - oduzmi;
    if (cnt > b)
      ans.push_back(-1);
    else {
      last = max(seg[(int)seg.size() - 1], poc[i]) + len[i];
      ans.push_back(last);
      seg.push_back(last);
    }
  }
  for (int i = 0; i < (int)ans.size(); i++) printf("%I64d\n", ans[i]);
  return 0;
}
