*K2, P2. end with K2

Hello everybody so ive been making hats and when i tried some ribbing i made a mistake and found a pattern from the mistake that i really liked. Like Ribbing you knit two and purl two but with the last two switches it will be a knit 2 instead of purl 2 which doesnt give it the rib pattern

The only problem with my hat was that towards the end when decreasing my pattern i couldnt continue it and its a completely different pattern as i dont know how to implement this pattern while decreasing the hat.
How can i decrease the hat while maintaining the k2, p2 pattern?

thank you

You won’t be able to strictly continue the k2p2 rib but you can come close. You can k2tog on the first decrease row for example. When you knit across the row on the next round, you have to look at your sts: …p2k1p2…at the decrease. On the next decrease row, knit the k1 together with a purl st and so on. It’ll break the k2p2 pattern at the line of decreases but it’ll be a neat, regular line of decreases. Be sure to maintain your pattern between the decrease lines.