How does typecho get a specified number of categories

in the typecho official document, the following code gets all the categories

$this->widget("Widget_Metas_Category_List")->parse("<li><a href="{permalink}">{name}</a></li>"

want not to output all categories, as long as a specified number of categories (for example, only 2 categories), how should I write?

Menu