should be in settings then security.it will ask you to enter your password and enter new password.the other way is to go to setting and press restore fatory default.enter your security code and it will restore phone to factory settings.
should be phone security code default should be 0000.if you set the password you should know it.if you brought the phone of a m8 he or she should know it.if by any chance the phone was obtained illegally then we cant help you.