what happens when you reach the last two entries of the signal? how do you apply the filter then?
There's a few reasonable things you could do. The easiest thing would be to not apply the filter at all, so the result would have 2 fewer entries than the original signal. You could also pad the signal with 0s, or assume that the signal is periodic, so that in this case the first entry out of bounds would be 1, and then 3, etc.