Imagine two masses connected with a spring of elastic constant $k$ set up such that they can move freely in the vertical direction but are connected horizontally. They also cannot move in the horizontal direction, such that they are always at a (horizontal) distance $d$. There's $N=2$ degrees of freedom.
Obviously the spring is going to exert some force between the masses if you disturb them from their original position. But how do you determine this force, what would its potential be? It obviously can't be $F=-kx$ since the spring can't stretch in this direction. Are we to assume that these kinds of ideal spring simply do not exert force in this way and can stretch vertically infinitely?