#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();
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIGxsIGxvbmcgbG9uZwojZGVmaW5lIG5sICJcbiIKI2RlZmluZSBzeih4KSB4LnNpemUoKQoKdm9pZCBmYXN0aW8oKQp7Cglpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKSwgY2luLnRpZShudWxscHRyKSwgY291dC50aWUobnVsbHB0cik7CiNpZm5kZWYgT05MSU5FX0pVREdFCglmcmVvcGVuKCJpbnB1dC50eHQiLCAiciIsIHN0ZGluKSwgZnJlb3Blbigib3V0cHV0LnR4dCIsICJ3Iiwgc3Rkb3V0KTsKI2VuZGlmCn0KCnZvaWQgc29sdmUoKQp7CglpbnQgbiwgazsKCWNpbiA+PiBuID4+IGs7CglpbnQgYXJyW25dLCBjbnQgPSAwOwoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykKCXsKCQljaW4gPj4gYXJyW2ldOwoJCWlmKGFycltpXSA+PSBhcnJbayAtIDFdICYmIGFycltpXSA+IDApCgkJCWNudCsrOwoJfQoJY291dCA8PCBjbnQgPDwgbmw7Cn0KaW50IG1haW4oKQp7CglmYXN0aW8oKTsKCWludCB0ZXN0ID0gMTsKCS8vY2luID4+IHRlc3Q7Cglmb3IgKGludCB0YyA9IDE7IHRjIDw9IHRlc3Q7IHRjKyspCgl7CgkJc29sdmUoKTsKCX0KfQ==