#include <stdio.h>

int main()
{ 
    int N, L, br, j;
    br = 0;
    scanf("%d", &N);
    scanf("%d", &L);

    int x[N];
    for(int i = 0; i < N; i++) 
        scanf("%d", &x[i]);
    for(int i = 0; i < N; i++)
        {if (L < x[0])
        {br = -1;
        break;    
        }
        else if(L>x[i])
        br++;
        else if(L<x[i])
        break;
    }

    printf("%d", br);
    return 0;
}