Whisker Weave Fragments
Gats has arranged colored beads along a string. The color of the -th bead is .
He calls a contiguous fragment , where , clean-ended if all of the following conditions hold:
- Exactly distinct colors occur among .
For a fragment consisting of one bead, that bead is considered both endpoints and its color occurs once.
Count the number of clean-ended fragments.
Input
The first line contains two integers and (), the number of beads and the required number of distinct colors.
Output
Print one integer: the number of clean-ended fragments.
Samples
Sample 1
Input
7 3 1 2 1 3 2 4 3
Output
4
The four qualifying fragments have endpoint pairs , , , and .