```go
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
type Problem struct {
id, a, t int
}
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
readInt := func() int {
scanner.Scan()
val, _ := strconv.Atoi(scanner.Text())
return val
}
if !scanner.Scan() {
return
}
n, _ := strconv.Atoi(scanner.Text())
T := int64(readInt())
probs := make([]Problem, n)
for i := 0; i < n; i++ {
probs[i] = Problem{id: i + 1, a: readInt(), t: readInt()}
}
// Sort problems by time ascending to greedily pick minimal time problems
sort.Slice(probs, func(i, j int) bool {
return probs[i].t < probs[j].t
})
// Binary search for the maximum score 'ans'
// If we want score K, we must pick at least K problems satisfying a_i >= K.
// To minimize time, we pick exactly K problems with smallest t among valid ones.
l, r := 1, n
ans := 0
for l <= r {
mid := (l + r) / 2
cnt := 0
var sumT int64 = 0
possible := false
for _, p := range probs {
if p.a >= mid {
sumT += int64(p.t)
cnt++
if cnt == mid {
if sumT <= T {
possible = true
}
break
}
}
}
if possible {
ans = mid
l = mid + 1
} else {
r = mid - 1
}
}
fmt.Fprintln(out, ans)
fmt.Fprintln(out, ans)
if ans > 0 {
cnt := 0
first := true
for _, p := range probs {
if p.a >= ans {
if !first {
fmt.Fprint(out, " ")
}
fmt.Fprint(out, p.id)
first = false
cnt++
if cnt == ans {
break
}
}
}
}
fmt.Fprintln(out)
}
```