Low-resolution near-infrared spectroscopic signatures of unresolved ultracool companions to M dwarfs