output_description: Print a sequence of the minimum in a line. Print a space character between
  adjacent elements.
input_description: The input is given in the following format.
  
  $N$ $L$  
  $a_1$ $a_2$ ... $a_N$
attempt: import sys
  
  input = sys.stdin.readline
  import math
  
  sys.setrecursionlimit(20000)
  
  
  def update(tree, x, y, N):
      # offset
      # x += int(N/2)
      x += N - 1
      tree[x] = y
      # segment tree no update suru
      while True:
          if x <= 0:
              break
          x = math.floor((x - 1) / 2)
          left = x * 2 + 1
          right = x * 2 + 2
          tree[x] = min(tree[left], tree[right])
  
  
  def find(tree, x, y, k, l, r):
  
      if r <= x or y <= l:
          return 2**31 - 1
      # sita wo mite itte mitukatta toki (intersect)
      if x <= l and r <= y:
          return tree[k]
      # sita ni sagaru
      v_left = find(tree, x, y, k * 2 + 1, l, int((l + r) / 2))
      v_right = find(tree, x, y, k * 2 + 2, int((l + r) / 2), r)
      return min(v_left, v_right)
  
  
  if __name__ == "__main__":
      _N, k = map(int, input().split())
      arr = list(map(int, input().split()))
      INT_MAX = 2**31 - 1
      N = 1
      res = []
      while True:
          if N >= _N:
              break
          N *= 2
      # N = 2*N - 1 - 1
      if not (N == 1):
          A_bin_tree = [INT_MAX] * (2 * N - 1)
      else:
          A_bin_tree = [INT_MAX]
      for i in range(k):
          update(A_bin_tree, i, arr[i], N)
  
      for i in range(_N - k):
          z = find(A_bin_tree, i, i + k, 0, 0, N)
          res.append(z)
          update(A_bin_tree, i + k, arr[i + k], N)
  
      print(" ".join([str(r) for r in res]))
  
problem_description: Sliding Minimum Element
  
  For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer
  $L$, find the minimum of each possible sub-arrays with size $L$ and print them
  from the beginning. For example, for an array $\\{1, 7, 7, 4, 8, 1, 6\\}$ and
  $L = 3$, the possible sub-arrays with size $L = 3$ includes $\\{1, 7, 7\\}$,
  $\\{7, 7, 4\\}$, $\\{7, 4, 8\\}$, $\\{4, 8, 1\\}$, $\\{8, 1, 6\\}$ and the
  minimum of each sub-array is 1, 4, 4, 1, 1 respectively.
samples: [{"input": "7 3\n    1 7 7 4 8 1 6", "output": "1 4 4 1 1"}]