Count the Number of Arrays with K Matching Adjacent Elements