#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define nl "\n"
#define sz(x) x.size()

void fastio()
{
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#endif
}

void solve()
{
	int n, k;
	cin >> n >> k;
	int arr[n], cnt = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> arr[i];
		if(arr[i] >= arr[k - 1] && arr[i] > 0)
			cnt++;
	}
	cout << cnt << nl;
}
int main()
{
	fastio();
	int test = 1;
	//cin >> test;
	for (int tc = 1; tc <= test; tc++)
	{
		solve();
	}
}