A king has a chest that is filled with pearls. He wants to find a good and reliable treasurer to take care of his pearls. As such, he created a riddle for his villagers to solve; whosever solved it correctly first will become the new royal treasurer. The riddle is as follows:
"In this chest I have a number of pearls.
If I remove one, the number becomes a perfect square.
If I remove 2, the number becomes a multiple by 9.
If I divide these pearls amongst 5 knights equally, there is 1 left over.
If I divide them amongst 8 knights, then there are 5 left over.
The number of pearls is prime."
What is the minimum number of pearls in the king's chest?