{"id":22442763,"url":"https://github.com/amitthecoder/next-round","last_synced_at":"2025-03-27T10:18:07.615Z","repository":{"id":265010495,"uuid":"869245714","full_name":"amitthecoder/Next-Round","owner":"amitthecoder","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-08T01:17:00.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T12:17:52.970Z","etag":null,"topics":["codeforces","codeforces-problems","codeforces-solutions","codeforces-solutions-github","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amitthecoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-08T01:12:42.000Z","updated_at":"2024-10-08T01:18:08.000Z","dependencies_parsed_at":"2024-11-27T08:15:34.254Z","dependency_job_id":null,"html_url":"https://github.com/amitthecoder/Next-Round","commit_stats":null,"previous_names":["amitthecoder/next-round"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitthecoder%2FNext-Round","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitthecoder%2FNext-Round/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitthecoder%2FNext-Round/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amitthecoder%2FNext-Round/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amitthecoder","download_url":"https://codeload.github.com/amitthecoder/Next-Round/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245823318,"owners_count":20678173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeforces","codeforces-problems","codeforces-solutions","codeforces-solutions-github","kotlin"],"created_at":"2024-12-06T02:20:23.234Z","updated_at":"2025-03-27T10:18:07.595Z","avatar_url":"https://github.com/amitthecoder.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next Round\n\ntime limit per test - 3 seconds\n\nmemory limit per test - 256 megabytes\n\n\"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score...\" — an excerpt from contest rules.\n\nA total of n participants took part in the contest (n ≥ k), and you already know their scores. Calculate how many participants will advance to the next round.\n\n### Input\nThe first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 50) separated by a single space.\n\nThe second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 100), where ai is the score earned by the participant who got the i-th place. The given sequence is non-increasing (that is, for all i from 1 to n - 1 the following condition is fulfilled: ai ≥ ai + 1).\n\n### Output\nOutput the number of participants who advance to the next round.\n\n## Examples\n### Input\n8 5\n\n10 9 8 7 7 7 5 5\n### Output\n6\n### Input\n4 2\n\n0 0 0 0\n### Output\n0\n\nNote - In the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.\n\nIn the second example nobody got a positive score.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famitthecoder%2Fnext-round","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famitthecoder%2Fnext-round","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famitthecoder%2Fnext-round/lists"}