#include <fstream>
#include <algorithm>
#include <vector>

using namespace std;

void QuickSort(vector<int>&, vector<int>&, int&, int&);

int BinarySearch(vector<int>&, vector<int>&, int &, int&, int&);

int main()
{
	ifstream input("TKNP.inp");
	ofstream output("TKNP.out");

	int n, k;
	input >> n >> k;

	vector <int> Data(n), Index(n);
	for (int i = 0; i < n; i++)
	{
		input >> Data[i];
		Index[i] = i;
	}
	int l = 0;
	int r = n - 1;
	QuickSort(Data, Index, l, r);
	l = 0;
	r = n - 1;
	output << BinarySearch(Data, Index, k, l, r);
	input.close();
	output.close();
	return 0;
}

void QuickSort(vector <int> &Data, vector <int> &Index, int &l, int &r)
{
	// If the first index less or equal than the last index
	if (l <= r)
	{
		// Create a Key/Pivot Element
		int key = Data[(l + r) / 2];

		// Create temp Variables to loop through array
		int i = l;
		int j = r;

		while (i <= j)
		{
			while (Data[i] < key)
				i++;
			while (Data[j] > key)
				j--;

			if (i <= j)
			{
				swap(Data[i], Data[j]);
				swap(Index[i], Index[j]);
				i++;
				j--;
			}
		}

		// Recursion to the smaller partition in the array after sorted above
		if (l < j)
			QuickSort(Data, Index, l, j);
		if (r > i)
			QuickSort(Data, Index, i, r);
	}
}

int BinarySearch(vector <int> &Data, vector <int> &Index, int &k, int &l, int &r)
{
	if (l <= r)
	{
		int key = Data[(l + r) / 2];

		if (k > key)
		{
			l = (l + r) / 2 + 1;
			BinarySearch(Data, Index, k, l, r);
		}
		else if (k < key)
		{
			r = (l + r) / 2 - 1;
			BinarySearch(Data, Index, k, l, r);
		}
		else
		{
			return Index[(l + r) / 2] + 1;
		}
	}
	else
	{
		return -1;
	}
}