N, M = map(int, input().split()) items = [] for i in range(N): V, W = map(int, input().split()) items.append((V, W)) def knapsack(min_v): dp = [-1] * (M+1) dp[0] = 0 for v, w in items: if v < min_v: continue for i in reversed(range(M)): if dp[i] == -1: continue if i+w > M: continue dp[i+w] = max(dp[i+w], dp[i] + v) return max(dp) vset = set(v for v, _ in items) ans = 0 for v in vset: ans = max(ans, v * knapsack(v)) print(ans)