def solve(n, m, vw): ans = 0 vw.sort(key = lambda x: x[0], reverse = True) dp = [[0] * (m + 1) for _ in range(n + 1)] for i in range(n): v, w = vw[i] for j in range(m + 1): dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]) if j + w <= m: if dp[i + 1][j + w] < dp[i][j] + v: dp[i + 1][j + w] = dp[i][j] + v ans = max(ans, v * dp[i + 1][j + w]) return ans n, m = map(int,input().split()) vw = [list(map(int,input().split())) for _ in range(n)] print(solve(n, m, vw))