Problem: A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times bigger than kayaks (and occupy the space of 2 cubic metres).

Each waterborne vehicle has a particular carrying capacity, and it should be noted that waterborne vehicles that look the same can have different carrying capacities. Knowing the truck body volume and the list of waterborne vehicles in the boat depot (for each one its type and carrying capacity are known), find out such set of vehicles that can be taken in the lorry, and that has the maximum total carrying capacity. The truck body volume of the lorry can be used effectively, that is to say you can always put into the lorry a waterborne vehicle that occupies the space not exceeding the free space left in the truck body.

Input

The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi (1 ≤ ti ≤ 2; 1 ≤ pi ≤ 104), where ti is the vehicle type (1 – a kayak, 2 – a catamaran), and pi is its carrying capacity. The waterborne vehicles are enumerated in order of their appearance in the input file.

Output

In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them.

Examples

Input

3 2
1 2
2 7
1 3


Output

7
2

Solution (in PYTHON3):

Solution:
n, v = map(int, input().split())
baydarki, katamaran = [], []
for i in range(n):
    t, p = map(int, input().split())
    if t == 1:
        baydarki.append([p,i+1])
    else:
        katamaran.append([p,i+1])
baydarki.sort(reverse=True)
katamaran.sort(reverse=True)
#print('baydarky ',baydarki)
#print('katamaran ',katamaran)

load1, load2 = [0], [0]
capacity = 0
for i in range(min(v,len(baydarki))):
    capacity += baydarki[i][0]
    load1.append(capacity)
capacity = 0
#print('load1 ', load1)
for i in range(min(v//2, len(katamaran))):
    capacity += katamaran[i][0]
    load2.append(capacity)
#print('load2 ', load2)


def find_best_load():
    best = step = res = 0
    pos = min(v,len(baydarki))+1
    for i in range(pos):
        kat_posibilities = int((v-i)/2)
        idx_best_katamarans = min(len(katamaran),kat_posibilities)
        best = load1[i] + load2[idx_best_katamarans]
        if best > res:
            res = best
            step = i
    #print('step ', step)
    #print('best',best)
    return res, step

def display_solution(r, step):
    print(r)
    for i in range(step):
        print(baydarki[i][1], end=' ')
    katamaran_range = min(len(katamaran), int((v-step)/2))
    for i in range(katamaran_range):
        print(katamaran[i][1], end=' ')

r, s = find_best_load()
display_solution(r, s)

'''
best = res = num = 0
for i in range(min(v,len(baydarki))+1):
    best = load1[i] + load2[min(len(katamaran),int((v-i)/2))]
    print('------------')
    print('best ', best)
    print('res ', res)
    if best > res:
        res = best
        print('updated res ', res)
        num = i
        print('at step ', num)

print(res)
for i in range(num) :
    print(baydarki[i][1], end=' ')
for i in range(min(len(katamaran), int((v-num)/2))):
    print(katamaran[i][1], end=' ')
'''
'''
A exemple by steps:
input :

10 10
1 14
2 15
2 11
2 12
2 9
1 14
2 15
1 9
2 11
2 6
Output:

baydarky  [[14, 6], [14, 1], [9, 8]]
katamaran  [[15, 7], [15, 2], [12, 4], [11, 9], [11, 3], [9, 5], [6, 10]]
load1  [0, 14, 28, 37]
load2  [0, 15, 30, 42, 53, 64]
------------
best  64              # ultimul element din load2
res  0
updated res  64
at step  0            # iteratia 0
------------
best  67              # 14 din load1 + 53 din load2 = 67, (4-katamarane, 1-baydarka)
res  64
updated res  67
at step  1
------------
best  81              # 28(load1) + 53(load2) = 81 , (2-baydarka, 4-katamaran) , ocupa maxim capacitate din v=10
res  67
updated res  81       # actualizat
at step  2            # actualizat
------------
best  79              # 47(load1) + 42(load2) = 79 , la fel ocupa capacitate v=10, insa suma este mai mica si nu actualizam res
res  81
81                    # raspunsul:
6 1 7 2 4 9
'''