A Strange Sequence

You get the first N terms, each later term equals the count of distinct values before it, and you must output the Mth term.

Medium5SimulationHash mapMathNo attempts yetTime limit1sMemory limit64 MB

Problem

Seunghyun built a sequence BB with the following rule.

  • Bi=SiB_i = S_i for 1iN1 \le i \le N
  • BiB_i is the number of distinct values among B1,B2,,Bi1B_1, B_2, \dots, B_{i-1} for i>Ni > N

Here SS is a sequence of length NN that Seunghyun thought up on his own.

Seunghyun wants to know the MMth term of BB. Write a program that computes that value for him.

Input

The first line contains NN, the length of the sequence SS.

The second line contains S1,S2,,SNS_1, S_2, \dots, S_N in order, separated by spaces.

The third line contains MM.

  • 1N500001 \le N \le 50000
  • 1M1091 \le M \le 10^9, and MM is a natural number
  • every element of SS is an integer with 1000000Si1000000-1000000 \le S_i \le 1000000

Output

Print the MMth term of the sequence BB.

Hint

If N=4N = 4 and S=(2,13,7,2)S = (2, 13, -7, 2), the first nine terms of BB are 2,13,7,2,3,4,5,6,72, 13, -7, 2, 3, 4, 5, 6, 7.