input: from typing import List
  
  def find_ball_holder_after_seconds(n: int, k: int) -> int:
      """
      You are given two positive integers n and k. n children are standing in a line numbered from 0 to n - 1.
  
      At the start, child 0 has the ball, and it is passed to the right. Each second, the child who has the ball passes it to the next child in line. When the ball reaches the end of the line (either child 0 or child n - 1), the direction of passing is reversed.
  
      Return the index of the child holding the ball after k seconds.
  
      Examples:
      >>> n = 3, k = 5
      1
      >>> n = 5, k = 6
      2
  
      Constraints:
      2 <= n <= 50
      1 <= k <= 50
      """
output:     # Initially, the ball is with child 0
      position = 0
      direction = 1  # 1 means passing to the right, -1 means passing to the left
      
      for _ in range(k):
          position += direction
          # reverse direction if we reach either end of the line
          if position == 0 or position == n - 1:
              direction *= -1
      
      return position