#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const int MAXN = (int)2e5 + 10;
int n, q, T = 0;
set<pair<long long, long long> > quest;
int t[MAXN], d[MAXN];
int len;
long long NOT = 0;
int main() {
  ios_base ::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 1; i <= n; i++)
    cin >> t[i] >> d[i], quest.insert(pair<long long, long long>(t[i], 1));
  while (!quest.empty()) {
    pair<long long, long long> a = *quest.begin();
    quest.erase(quest.begin());
    if (!a.second) {
      if (len)
        len--;
      else
        NOT = 0;
      continue;
    }
    T++;
    if (len == q) {
      cout << -1 << " ";
      continue;
    }
    if (!NOT)
      NOT = a.first;
    else
      len++;
    NOT += d[T];
    quest.insert(pair<long long, long long>(NOT, 0));
    cout << NOT << " ";
  }
}
