Create a Python program to determine whether a given spectrum is valid.
spectrum = [15, 16, 18, 21, 25, 28]
def is_valid_spectrum(spectrum):
    m = spectrum[0]
    for n in spectrum[1:]:
        if n - m not in [1, 2]:
            return False
        m = n
    return True