N, M = map(int, input().split()) VW = [tuple(map(int, input().split())) for _ in range(N)] DP = [[-1] * (M + 1) for _ in range(N + 1)] DP[0][0] = 0 def chmax(DP,i,v): if DP[i] < v: DP[i] = v def chmin(DP,i,v): if DP[i] > v: DP[i] = v VW.sort(key=lambda x: x[0], reverse=True) for i in range(N): for j in range(M + 1): if DP[i][j] == -1: continue # 不採用 chmax(DP[i + 1], j, DP[i][j]) v, w = VW[i] # 採用 if j + w <= M: chmax(DP[i + 1], j + w, DP[i][j] + v) ansl = [] for i in range(1, N + 1): min_beauty = VW[i - 1][0] total_beauty = max(DP[i]) ansl.append(min_beauty * total_beauty) ans = max(ansl) print(ans)