We consider search for a randomly moving target among a finite set of different states, A search effort is available at each fixed number of time intervals and it is unrestricted, this is important for searching about a valuable target missing at sea or lost at wilderness area. We obtain the solution which minimizes the probability of undetected the target and searching effort. An algorithm is constructed for obtained this solution, also it used to obtain the optimal solution when the searching effort is restricted.