#Copy nói admin
def knapsack(N, M, d):
a = b = c = 0
for m in range(1 << N):
a1 = 0
a2 = 0
cnt = 0
for i in range(N):
if m & (1 << i):
a1 += d[i][0]
a2 += d[i][1]
cnt += 1
if a1 <= M and a2 > a:
a = a2
b = m
c = cnt
kq = []
for i in range(N):
if b & (1 << i):
kq.append(i + 1)
return c, kq
import sys
input = sys.stdin.read
data = input().splitlines()
N, M = map(int, data[0].split())
d = []
for i in range(1, N + 1):
W, V = map(int, data[i].split())
d.append((W, V))
cnt, kq = knapsack(N, M, d)
print(cnt)
print(' '.join(map(str, kq)))
I0NvcHkgbsOzaSBhZG1pbgpkZWYga25hcHNhY2soTiwgTSwgZCk6CiAgICBhID0gYiA9IGMgPSAwCiAgICBmb3IgbSBpbiByYW5nZSgxIDw8IE4pOgogICAgICAgIGExID0gMAogICAgICAgIGEyID0gMAogICAgICAgIGNudCA9IDAKICAgICAgICBmb3IgaSBpbiByYW5nZShOKToKICAgICAgICAgICAgaWYgbSAmICgxIDw8IGkpOgogICAgICAgICAgICAgICAgYTEgKz0gZFtpXVswXQogICAgICAgICAgICAgICAgYTIgKz0gZFtpXVsxXQogICAgICAgICAgICAgICAgY250ICs9IDEKICAgICAgICBpZiBhMSA8PSBNIGFuZCBhMiA+IGE6CiAgICAgICAgICAgIGEgPSBhMgogICAgICAgICAgICBiID0gbQogICAgICAgICAgICBjID0gY250CiAgICBrcSA9IFtdCiAgICBmb3IgaSBpbiByYW5nZShOKToKICAgICAgICBpZiBiICYgKDEgPDwgaSk6CiAgICAgICAgICAgIGtxLmFwcGVuZChpICsgMSkKCiAgICByZXR1cm4gYywga3EKaW1wb3J0IHN5cwppbnB1dCA9IHN5cy5zdGRpbi5yZWFkCmRhdGEgPSBpbnB1dCgpLnNwbGl0bGluZXMoKQpOLCBNID0gbWFwKGludCwgZGF0YVswXS5zcGxpdCgpKQpkID0gW10KZm9yIGkgaW4gcmFuZ2UoMSwgTiArIDEpOgogICAgVywgViA9IG1hcChpbnQsIGRhdGFbaV0uc3BsaXQoKSkKICAgIGQuYXBwZW5kKChXLCBWKSkKY250LCBrcSA9IGtuYXBzYWNrKE4sIE0sIGQpCnByaW50KGNudCkKcHJpbnQoJyAnLmpvaW4obWFwKHN0ciwga3EpKSk=