Subsegments
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. 
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). 
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".
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop

def I():
    return sys.stdin.readline()

def II():
    return int(I())

def MII():
    return map(int, I().split())
(n, k) = MII()
dic = defaultdict(int)
q = []
st = deque()
nums = []
for _ in range(n):
    nums.append(II())
for x in nums:
    st.append(x)
    dic[x] += 1
    if dic[x] == 1:
        heappush(q, -x)
    while len(st) > k:
        y = st.popleft()
        dic[y] -= 1
        if dic[y] == 1:
            heappush(q, -y)
    if len(st) == k:
        have_ans = False
        tmp = -1
        while q and dic[-q[0]] != 1:
            heappop(q)
        if q and dic[-q[0]] == 1:
            print(-q[0])
        else:
            print('Nothing')
''
import sys
from collections import defaultdict, deque
from heapq import heappush, heappop

def I():
    return sys.stdin.readline()

def II():
    return int(I())

def MII():
    return map(int, I().split())
(n, k) = MII()
dic = defaultdict(int)
q = []
st = deque()
nums = []
for _ in range(n):
    nums.append(II())
for x in nums:
    st.append(x)
    dic[x] += 1
    if dic[x] == 1:
        heappush(q, -x)
    while len(st) > k:
        y = st.popleft()
        dic[y] -= 1
        if dic[y] == 1:
            heappush(q, -y)
    if len(st) == k:
        have_ans = False
        tmp = -1
        while q:
            x = -heappop(q)
            if dic[x] == 1:
                have_ans = True
                tmp = x
                break
        if have_ans:
            heappush(q, -tmp)
            print(tmp)
        else:
            print('Nothing')
''
import sys, math as mt
import heapq as hp
import collections as cc
import bisect as bi
input = sys.stdin.buffer.readline
I = lambda : list(map(int, input().split()))
(n, k) = I()
a = []
f = cc.defaultdict(int)
for i in range(n):
    a.append(-int(input()))
for i in range(k):
    f[a[i]] += 1
h = [mt.inf]
for i in f:
    if f[i] == 1:
        h.append(i)
hp.heapify(h)
f[mt.inf] = 1
print(-h[0] if h[0] < mt.inf else 'Nothing')
for (x, y) in zip(a, a[k:]):
    f[x] -= 1
    f[y] += 1
    if f[x] == 1:
        hp.heappush(h, x)
    if f[y] == 1:
        hp.heappush(h, y)
    while f[h[0]] != 1:
        hp.heappop(h)
    print(-h[0] if h[0] < mt.inf else 'Nothing')