n,S = map(int,input().split()) S = S//1000 cpiv = [] for i in range(0,n): CP,IV = map(int,input().split()) if IV <= 29: CP += S * 10 cpiv.append(CP) elif IV <= 39: CP += S * 50 cpiv.append(CP) else: CP += S * 100 cpiv.append(CP) max = max(cpiv) print(cpiv.index(max)+1, max)