#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <iomanip>
using namespace std;
#define all(v) (v.begin()), (v.end())
void fast_io(){
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
int main()
{
fast_io();
int n, k;
cin >> n >> k;
int participants[n];
int count = 0;
for (int i = 0; i < n; i++){
cin >> participants[i];
}
for (int i = 0; i < n; i++){
if (participants[i] > 0 && participants[i] >= participants[k]){
count++;
}
}
cout << count << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxzdGRpby5oPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxpb21hbmlwPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBhbGwodikgKHYuYmVnaW4oKSksICh2LmVuZCgpKQoKdm9pZCBmYXN0X2lvKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKSwgY2luLnRpZShudWxscHRyKSwgY291dC50aWUobnVsbHB0cik7Cn0KCmludCBtYWluKCkKewogICAgZmFzdF9pbygpOwogICAgaW50IG4sIGs7CiAgICBjaW4gPj4gbiA+PiBrOwogICAgaW50IHBhcnRpY2lwYW50c1tuXTsKICAgIGludCBjb3VudCA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKyl7CiAgICAgICAgY2luID4+IHBhcnRpY2lwYW50c1tpXTsKICAgIH0KICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKXsKICAgICAgICBpZiAocGFydGljaXBhbnRzW2ldID4gMCAmJiBwYXJ0aWNpcGFudHNbaV0gPj0gcGFydGljaXBhbnRzW2tdKXsKICAgICAgICAgICAgY291bnQrKzsKICAgICAgICB9CiAgICB9CiAgICBjb3V0IDw8IGNvdW50IDw8IGVuZGw7Cn0=