Any individual subject to this code is guilty of criminal trespass and shall be punished as a court-martial may direct if he or she is convicted of either of the following:
(1) Knowingly enters or remains unlawfully in a building or upon real property that is fenced or enclosed in a manner designed to exclude intruders.
(2) Knowingly enters or remains unlawfully in or on a premises.