program ss; uses Math; var D: LongWord; M: LongWord; Numbers: array[0..70000] of LongWord; Profit: LongWord; I: LongWord; MaxPrice: LongWord; begin {WriteLn(SizeOf(LongWord)); Exit;} Read(D); while (D > 0) do begin Read(M); Profit := 0; for I := 0 to D - 1 do Read(Numbers[I]); MaxPrice := 0; for I := D - 1 downto 0 do begin MaxPrice := Max(MaxPrice, Numbers[I]); Profit := Max(Profit, (MaxPrice - Numbers[I]) * (M div Numbers[I])); end; WriteLn(Profit); Read(D); end; {WriteLn('hello');} end.