Oxygen sensor codes

I have a 2007 mazda 6. I had the battery replaced and an hour later the check engine light came on. I had the codes pulled at auto zone and show p0131 and p2251
The employee said it could be the sensor, the sensor wiring or the sensor might have come loose.
Am I looking for 2 or 4 sensors?
Their are sensors on top and underneath. With the codes above what side do I need to be looking on for them?
When they changed the battery could they have knocked one of them loose?
Will I need to replace all the sensors or a specific one?
Around how much would I be looking at if I take it to a mechanic?

With those 2 codes, I would look to make sure the o2 sensor is plugged in
Both codes are for the same sensor, bank 1 sensor 1

If you have the 2.3 it would be the sensor before the cat.


Just bought it used. According to the specs it’s a 2.3. So I should be looking for two sensors underneath somewhere near the converter?

It’s somewhere between the exhaust manifold and the converter, probably close to the manifold.