from typing import List
import math


def _percentile_index(histogram: List[int], select_percentile: float = 0.95) -> int:
    """
    Given an array of elements where each ith element refer to ith frequency,
    finds the index of the percentile indicated by percentile.

    :param histogram: Array of frequencies of integers.
            Value of ith element should refer to the frequency of i.
    :param select_percentile: Percentile to use for selecting the number of seeds.
                For example, 0.5 will take the median number of seeds.
    :return: The median value of the values.
    """
    curr_total = 0
    median_pos = math.ceil(sum(histogram) * select_percentile)
    for i in range(len(histogram)):
        if curr_total + histogram[i] >= median_pos:
            return i
        curr_total += histogram[i]
    return len(histogram)