n, k = list(map(int, input().split())) s = int(input().split()) count = 1 for i in n: if s[i] != s[i+1]: count += 1 print(count)