Almost everywhere continuity

Let f be a map from \mathbb {R} to \mathbb {R}. Prove that the following are equivalent:
a) f is almost everywhere equal to a function g which is almost everywhere continuous
b) there is a set A of (Lebesgue) measure 0 such that the restriction of f to the complement of A is continuous in the relative topology.