This mantra is a 16-word Vaishnava mantra which is also called Maha-mantra. This mantra was mentioned in Kali-Santarana Upanishad. Here is the full matra:
हरे राम हरे रामा, रामा राम हरे हरे,
हरे कृष्ण हरे कृष्णा ,कृष्णा कृष्णा हरे हरे
हरे राम हरे रामा, रामा राम हरे हरे,
हरे कृष्ण हरे कृष्णा ,कृष्णा कृष्णा हरे हरे