#include <bits/stdc++.h>
using namespace std;
long long delbit(long long a, int k) { return a & (~(1ll << k)); }
int delbit(int a, int k) { return a & (~(1 << k)); }
bool getbit(long long a, int k) { return 1 & (a >> k); }
bool getbit(int a, int k) { return 1 & (a >> k); }
bool getbit(unsigned long long a, int k) { return 1 & (a >> k); }
long long setbit(long long a, long long k) { return a |= (1ll << k); }
int setbit(int a, int k) { return a |= (1 << k); }
inline long long mulmod(long long first, long long n, long long _mod) {
  long long res = 0;
  while (n) {
    if (n & 1) res = (res + first) % _mod;
    first = (first + first) % _mod;
    n >>= 1;
  }
  return res;
}
inline long long powmod(long long first, long long n, long long _mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * first) % _mod;
    first = (first * first) % _mod;
    n >>= 1;
  }
  return res;
}
inline long long gcd(long long a, long long b) {
  long long t;
  while (b) {
    a = a % b;
    t = a;
    a = b;
    b = t;
  }
  return a;
}
inline int gcd(int a, int b) {
  int t;
  while (b) {
    a = a % b;
    t = a;
    a = b;
    b = t;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long gcd(long long a, long long b, long long c) {
  return gcd(gcd(a, b), c);
}
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }
template <typename A, typename B>
ostream &operator<<(ostream &stream, const pair<A, B> &p) {
  stream << "{" << p.first << "," << p.second << "}";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const vector<A> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A, typename B>
ostream &operator<<(ostream &stream, const map<A, B> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const set<A> &v) {
  stream << "[";
  for (auto itr = v.begin(); itr != v.end(); itr++) stream << *itr << " ";
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const priority_queue<A> &v) {
  priority_queue<A> q = v;
  stream << "[";
  while (!q.empty()) {
    stream << q.top() << " ";
    q.pop();
  }
  stream << "]";
  return stream;
}
template <typename A>
ostream &operator<<(ostream &stream, const queue<A> &v) {
  queue<A> q = v;
  stream << "[";
  while (!q.empty()) {
    stream << q.front() << " ";
    q.pop();
  }
  stream << "]";
  return stream;
}
template <typename T, typename T2>
void printarr(T a[], T2 sz, T2 beg = 0) {
  for (T2 i = beg; i < sz; i++) cout << a[i] << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, b;
  cin >> n >> b;
  long long lst = 0, cnt = 0;
  map<long long, int> q;
  for (int(i) = (0); (i) < (n); (i)++) {
    int t, d;
    cin >> t >> d;
    if (lst <= t) {
      cout << t + d << " ";
      q.clear();
      cnt = 1;
      q[t + d]++;
      lst = t + d;
    } else {
      auto to = q.upper_bound(t);
      vector<int> del;
      for (auto it = q.begin(); it != to; ++it) {
        cnt -= it->second;
        del.push_back(it->first);
      }
      for (int(i) = (0); (i) < (del.size()); (i)++) q.erase(del[i]);
      if (cnt > b)
        cout << "-1 ";
      else {
        cnt++;
        lst += d;
        q[lst]++;
        cout << lst << " ";
      }
    }
  }
  return 0;
}
