When you add the custom control Page n of m, you can see in the heirarchy 3 fields are added.
Two TextFields "CurrentPage", "PageCount" and one Text Object "Pages"..
You need to write the below code in the Layout Ready event of the CurrentPage control to hide the "Pages" control.
clientDetails.MasterPages.Page1.CurrentPage::ready:layout - (JavaScript, client)
this.rawValue = xfa.layout.page(this);
if(this.rawValue == 1){
Pages.presence= "hidden";
}
Thanks
Srini