#include<stdio.h>
#define MAX_LEN 100000
 
typedef struct {
    char name[11];
    int val;
} dic;
 
dic arr[MAX_LEN];
int head, tail;
 
int enqueue(dic x){
    if(tail+1 == head){
        printf("OverFlow\n");
        return 0;
    }
    arr[tail] = x;
    if(tail+1 == MAX_LEN){
        tail=0;
    }else{
        tail++;
    }
    return 0;
}
 
dic dequeue(){
    if(head+1 == MAX_LEN){
        head=0;
        return arr[MAX_LEN-1];
    }else{
        head++;
        return arr[head-1];
    }
}
 
int main(){
    int num, time, i, time_sum=0;
    dic task;
    scanf("%d %d", &num, &time);
    int task_num = num;
    head = 0;
    tail = num;
    for(i=0; i<num; i++){
        scanf("%s %d", arr[i].name, &arr[i].val);
    }
    while(task_num!=0){
        task = dequeue();
        if(task.val <= time){
            printf("%s %d\n", task.name, time_sum+task.val);
            task_num--;
            time_sum += task.val;
        }else{
            task.val -= time;
            enqueue(task);
            time_sum += time;
        }
    }
    return 0;
}