// No.2492 Knapsack Problem? package main import "fmt" func main() { var n, w int fmt.Scan(&n, &w) vv, ww := 0, 0 ans := -1 for i := 0; i < n; i++ { fmt.Scan(&vv, &ww) if ww <= w { ans = max(ans, vv) } } fmt.Println(ans) }