Those two abbreviations stand for "ante meridiem" and "post meridiem". They mean "before noon" and "after noon" in Latin.

Because most clocks today use the 12-hour incremented display to divide the 24-hour day, a new method of reading time was invented. Right now, when reading time and including a.m. after the reading, it means that the time is between 0:00 and noon, and if p.m. is included, it means between noon and 0:00.