#include <bits/stdc++.h>
using namespace std;
int a[500001], id[4 * 500001];
long long t[4 * 500001];
void build(int a[], int v, int tl, int tr) {
  if (tl == tr) {
    t[v] = a[tl];
    id[v] = tl;
  } else {
    int tm = (tl + tr) / 2;
    build(a, v * 2, tl, tm);
    build(a, v * 2 + 1, tm + 1, tr);
    t[v] = min(t[v * 2], t[v * 2 + 1]);
    if (t[v * 2] < t[v * 2 + 1])
      id[v] = id[2 * v];
    else
      id[v] = id[2 * v + 1];
  }
}
void update(int v, int tl, int tr, int pos, long long new_val) {
  if (tl == tr)
    t[v] = new_val;
  else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val);
    t[v] = min(t[v * 2], t[v * 2 + 1]);
    if (t[v * 2] < t[v * 2 + 1])
      id[v] = id[2 * v];
    else
      id[v] = id[2 * v + 1];
  }
}
int main() {
  int n, m;
  long long time, x;
  scanf("%i%i", &n, &m);
  memset(a, 0, sizeof(a));
  build(a, 1, 1, m);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", &x, &time);
    if (t[1] > x) {
      long long p = t[1] + time;
      update(1, 1, m, id[1], p);
      printf("%I64d\n", p);
    } else {
      long long p = x + time;
      update(1, 1, m, id[1], p);
      printf("%I64d\n", p);
    }
  }
}
