跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1151. Subsegments

  • ID: 1157
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:进阶
  • 上传者:
  • 数据结构
  • 模拟
  • 编程与模拟
  • 进阶
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

Subsegments

题目描述

E. Subsegments
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maximum element of those that occur on the given segment exactly once. Help Sasha solve this problem.

Input

The first line contains two positive integers n and k (1≤n≤105,1≤k≤n) − the number of array elements and the length of the segment.

Then follow n lines: the i-th one contains a single number ai (-109≤ai≤109).

Output

Print n—k+1 numbers, one per line: on the i-th line print of the maximum number of those numbers from the subarray ai ai+1 … ai+k-1 that occur in this subarray exactly 1 time. If there are no such numbers in this subarray, print "Nothing".

Examples
Input
5 3
1
2
2
3
3
Output
1
3
2
Input
6 4
3
3
3
4
4
2
Output
4
Nothing
3

题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 621 题。保留原作者与原赛事署名。