#include<stdio.h>
#include<vector>
#include<stdint.h>

int main(int argc, char const *argv[])
{
    bool unlock = true;
    unsigned long int answer;
    unsigned long int j;
    unsigned long int lenght;
    unsigned long int perica = 0;

    printf("koliko ima stalaktita u pecini? >");
    scanf("%ld", &lenght);
    if((lenght < 1)||(lenght > 1000)){printf("nedozvoljena vrednost!!!"); return 0;}
    std::vector<unsigned long int> cave;
    cave.reserve(lenght);
    printf("kolika je visina Perice? >");
    scanf("%ld", &perica);
    if((perica < 1)||(perica > 1000000000)){printf("nedozvoljena vrednost!!!"); return 0;}
    printf("uspisati niz stalaktita: \n");
    for(unsigned long int i = 0; i < lenght; i++){
        //printf("uneti vrednost %d. stalaktita: ", i+1);
        //trebalo mi je 2h da debagujem problem u c++ type konverziji :)
        scanf("%ld", &j);
        cave.push_back(j);
        if((j < 1)||(j > 1000000000)){printf("nedozvoljena vrednost!!!"); return 0;}
        if((j <= perica) && unlock) {
            answer = i+1;
            unlock = false;
        }
    }
    if(unlock){printf("-1 \n");}
    else{printf("%ld\n", answer);}
    return 0;
}