n,ms = map(int, input().split())
a = [list(map(str, input().split())) for _ in range(n)]
total = 0
for i in a:
    tmp = int(i[1]) - ms
    if tmp <= 0:
        total += ms + tmp
        print("{} {}".format(i[0], total))
    else:
        total += ms
        a.append([i[0], tmp]) n,ms = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split ms list(map(str, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(str, input().split())) list map(str, input().split()) map str input().split() ().split () input split a = [list(map(str, input().split())) for _ in range(n)] a [list(map(str, input().split())) for _ in range(n)] total = 0 total 0 for i in a:
    tmp = int(i[1]) - ms
    if tmp <= 0:
        total += ms + tmp
        print("{} {}".format(i[0], total))
    else:
        total += ms
        a.append([i[0], tmp]) i a tmp = int(i[1]) - ms tmp int(i[1]) - ms int(i[1]) int i[1] i 1 ms if tmp <= 0:
        total += ms + tmp
        print("{} {}".format(i[0], total))
    else:
        total += ms
        a.append([i[0], tmp]) tmp <= 0 tmp 0 total += ms + tmp total ms + tmp ms tmp print("{} {}".format(i[0], total)) print "{} {}".format(i[0], total) "{} {}".format "{} {}" format i[0] i 0 total total += ms total ms a.append([i[0], tmp]) a.append a append [i[0], tmp] i[0] i 0 tmp total += ms + tmp ms + tmp total ms = map(int, input().split()) map(int, input().split()) ms total = 0 0 total n,ms = map(int, input().split()) map(int, input().split()) n tmp = int(i[1]) - ms int(i[1]) - ms tmp total += ms ms total a = [list(map(str, input().split())) for _ in range(n)] [list(map(str, input().split())) for _ in range(n)] a
n,ms = map(int, input().split())
a = [list(map(str, input().split())) for _ in range(n)]
total = 0
for i in a:
    tmp = int(i[1]) - ms
    if tmp <= 0:
        total += ms + tmp
        print("{} {}".format(i[0], total))
    else:
        total += ms
        a.append([i[0], tmp])
