Fermi Detects Gamma-ray Puzzle from M31