Almost any second hand laptop with Office had it installed illegally. And I would double check the Windows setup also. If you check craigslist people are selling Windows 7 setups with a full Office setup for $150. Just the software, if purchased legally would be $300.
The only way to check is to contact MS and see who owns the license key that was used.
Not sure I totally agree with Hang. If you look on the bottom of the laptop there should be a COA. Assuming there is you should be fine as you are now the owner of the laptop and have the right to use windows. As long as the version matches and using jellybean the code does as well, there is nothing illegal that I know of.
I would be weary of office as that's a different issue. Open office should fix that issue however.