AtCoder Beginner Contest 161 - Popular Vote

We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.
If M popular items can be selected, print Yes; otherwise, print No.

-----Constraints-----
 - 1 \leq M \leq N \leq 100
 - 1 \leq A_i \leq 1000
 - A_i are distinct.
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N M
A_1 ... A_N

-----Output-----
If M popular items can be selected, print Yes; otherwise, print No.

-----Sample Input-----
4 1
5 4 2 1

-----Sample Output-----
Yes

There were 12 votes in total. The most popular item received 5 votes, and we can select it.

Source: atcoder | Difficulty: EASY


Solutions:
(n, m) = map(int, input().split())
li = list(map(int, input().split()))
border = 4 * m
popular = 0
for i in range(len(li)):
	if li[i] < sum(li) * (1 / border):
		continue
	popular += 1
if popular >= m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if a[n - m] / sum(a) < 1 / (4 * m):
	print('No')
else:
	print('Yes')


(n, m) = map(int, input().split())
A = sorted(list(map(int, input().split())))[::-1]
print('Yes' if A[m - 1] >= sum(A) / (4 * m) else 'No')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
if l[0 - m] >= sum(l) / (4 * m):
	print('Yes')
else:
	print('No')


[N, M] = list(map(int, input().split()))
A = list(map(int, input().split()))
print(['No', 'Yes'][int(len(list(filter(lambda Ai: Ai >= sum(A) / 4 / M, A))) > M - 1)])


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
lim = sum(a) / (4 * m)
for i in a:
	if i >= lim:
		ans += 1
if ans >= m:
	print('Yes')
else:
	print('No')


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
if l[k - 1] < sum(l) / (4 * k):
	print('No')
else:
	print('Yes')


(N, M) = list(map(int, input().split()))
A = sorted([int(x) for x in input().split()], reverse=True)
sumA = sum(A)
if A[M - 1] >= sumA / (4 * M):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
new_a = [i for i in a if 4 * i * m >= sum(a)]
print(['Yes', 'No'][len(new_a) < m])


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
s = sum(a)
for x in a:
	if x >= s / (4 * m):
		cnt += 1
if cnt >= m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
b = list(map(int, input().split()))
s = sum(b)
a = [i for i in b if i >= s / (4 * m)]
print('Yes' if len(a) >= m else 'No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
if sum((x >= sum(a) / (4 * m) for x in a)) >= m:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
X = sum(A)
print('Yes' if sum((4 * M * a >= X for a in A)) >= M else 'No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
A.sort()
if A[-M] >= S / (4 * M):
	print('Yes')
else:
	print('No')


(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
S = sum(A)
ans = 'No'
for i in range(M):
	if A[i] >= S / (4 * M):
		ans = 'Yes'
	else:
		ans = 'No'
		break
print(ans)


def main():
	(N, M) = tuple([int(_x) for _x in input().split()])
	A = [int(_x) for _x in input().split()]
	total = sum(A)
	if total % (4 * M) == 0:
		min_vote = total // (4 * M)
	else:
		min_vote = 1 + total // (4 * M)
	cnt = 0
	for vot in A:
		if vot >= min_vote:
			cnt += 1
	if cnt >= M:
		print('Yes')
	else:
		print('No')
main()


(n, m, *A) = map(int, open(0).read().split())
A.sort(reverse=1)
x = sum(A)
print('Yes' if A[m - 1] >= x / (4 * m) else 'No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
list.sort(A)
A.reverse()
if A[M - 1] < sum(A) / 4 / M:
	print('No')
else:
	print('Yes')


(N, M) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
if l[-M] >= sum(l) / 4 / M:
	print('Yes')
else:
	print('No')


(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
count = 0
for a in A:
	if a >= sum(A) / 4 / M:
		count += 1
print('Yes' if count >= M else 'No')


(N, M) = map(int, input().split())
(*A,) = sorted(map(int, input().split()))
print('YNeos'[A[-M] * 4 * M < sum(A)::2])


(N, M) = map(int, input().split())
A = [int(i) for i in input().split()]
S = 0
for i in range(N):
	S += A[i]
count = 0
for i in range(N):
	if A[i] >= S / (4 * M):
		count += 1
if M <= count:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
print('Yes' if sum(A) <= 4 * M * A[M - 1] else 'No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
B = sorted(A, reverse=True)
judge = sum(A) / (4 * M)
if B[M - 1] < judge:
	print('No')
else:
	print('Yes')


def main() -> None:
	(n, m) = list(map(int, input().split()))
	products = sorted(list(map(int, input().split())))
	is_able = sum(products) / (4 * m) <= products[-m]
	print('Yes' if is_able else 'No')
	return

def __starting_point():
	main()
__starting_point()


(N, M) = map(int, input().split())
A = [int(i) for i in input().split()]
A = sorted(A)[::-1]
print('Yes' if A[M - 1] >= sum(A) / (4 * M) else 'No')


(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
print('YNeos'[a[n - m] < sum(a) / (4 * m)::2])


(n, m) = map(int, input().split())
aa = list(map(int, input().split()))
total_aa = sum(aa)
cnt = 0
for a in aa:
	if a >= sum(aa) / (4 * m):
		cnt += 1
if cnt >= m:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
result = 'Yes'
for i in range(M):
	if A[i] / sum(A) < 1 / (4 * M):
		result = 'No'
		break
print(result)


(N, M) = map(int, input().split())
A = sorted(list(map(int, input().split())))
if A[N - M] >= sum(A) / M / 4:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))[::-1]
bar = sum(a)
print('Yes' if a[m - 1] * 4 * m >= bar else 'No')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
if A[m - 1] >= sum(A) / (4 * m):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * n
b = sorted(a, reverse=True)
c = sum(a)
if b[m - 1] >= c / (4 * m):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
s = sum(a)
for i in range(n):
	if a[i] >= s / (4 * m):
		count += 1
print('Yes' if count >= m else 'No')


(n, m) = map(int, input().split())
a = sorted(map(int, input().split()), reverse=True)
print('NYoe s'[all([1 if i >= sum(a) / (4 * m) else 0 for i in a[:m]])::2])


(n, m) = input().split(' ')
l = [int(x) for x in input().split(' ')]
l.sort()
if sum(l) > l[-int(m)] * 4 * int(m):
	print('No')
else:
	print('Yes')


(N, M) = map(int, input().split())
L = list(map(int, input().split()))
S = sum(L)
L.sort()
a = L[N - M]
if a * 4 * M < S:
	print('No')
else:
	print('Yes')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
for i in a:
	if i >= sum(a) / (4 * m):
		ans += 1
		if ans == m:
			print('Yes')
			return
	else:
		print('No')
		return


(N, M) = map(int, input().split())
A = [int(x) for x in input().split()]
S = sum(A)
print('Yes' if len([x for x in A if x * 4 * M >= S]) >= M else 'No')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
if l[n - m] >= sum(l) / (4 * m):
	print('Yes')
else:
	print('No')


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
total = sum(a)
cnt = 0
for _a in a:
	if _a * 4 * m >= total:
		cnt += 1
if cnt >= m:
	print('Yes')
else:
	print('No')


(m, n) = list(map(int, input().split()))
l_n = list(map(int, input().split()))
l_n.sort(reverse=True)
total_vote = 0
pop_pd = []
ans = 'Yes'
for i in l_n:
	total_vote += i
for (index, j) in enumerate(l_n, 1):
	if index > n:
		break
	if total_vote / (4 * n) > j:
		ans = 'No'
		break
print(ans)


(n, m) = map(int, input().split())
A = [int(i) for i in input().split()]
s = sum(A)
A.sort(reverse=1)
if A[m - 1] * 4 * m >= s:
	print('Yes')
else:
	print('No')


def readinput():
	(n, m) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	return (n, m, a)

def main(n, m, a):
	a.sort(reverse=True)
	total = sum(a)
	if a[m - 1] * (4 * m) < total:
		return 'No'
	else:
		return 'Yes'

def __starting_point():
	(n, m, a) = readinput()
	ans = main(n, m, a)
	print(ans)
__starting_point()


(n, m) = map(int, input().split())
t = list(map(int, input().split()))
d = sum(t) / (4 * m)
a = [x for x in t if x >= d]
print(['Yes', 'No'][len(a) < m])


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
if a[-m] >= sum(a) * 1 / (4 * m):
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
s = sum(A)
if 4 * M * A[M - 1] >= s:
	print('Yes')
else:
	print('No')


(n, m, *a) = map(int, open(0).read().split())
A = sum(a)
print('Yes' if sum((i >= A / (4 * m) for i in a)) >= m else 'No')


(N, M) = list(map(int, input().split()))
num_list = list(map(int, input().split()))
X = sum(num_list)
s = 0
while s < N:
	if num_list[s] < X / (4 * M):
		del num_list[s]
		N = N - 1
	else:
		s = s + 1
if len(num_list) >= M:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A_l = sorted(map(int, input().split()))
S = sum(A_l)
ans = 0
for i in range(N):
	if A_l[i] * 4 * M >= S:
		ans += 1
	else:
		continue
if ans >= M:
	print('Yes')
else:
	print('No')


def main():
	(n, m) = list(map(int, input().split()))
	a = [int(v) for v in input().split()]
	total = sum(a)
	variant = total * (1 / (4 * m))
	cnt = 0
	for i in a:
		if i >= variant:
			cnt += 1
	return 'Yes' if cnt >= m else 'No'

def __starting_point():
	print(main())
__starting_point()


import math
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n):
	if a[i] >= math.ceil(sum(a) / (4 * m)):
		count += 1
if count >= m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
lis = sorted(list(map(int, input().split())), reverse=True)
con = 0
for i in range(n):
	if lis[i] >= sum(lis) * (1 / (4 * m)):
		con += 1
		if con == m:
			print('Yes')
			return
print('No')


(n, m, *a) = map(int, open(0).read().split())
s = sum(a)
f = sum((x * 4 * m >= s for x in a))
if f >= m:
	print('Yes')
else:
	print('No')


(a, b) = input().split()
a = int(a)
b = int(b)
c = list(map(int, input().split()))
c.sort()
if c[-b] >= sum(c) / (4 * b):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
x = 0
ans = 0
for i in range(n):
	x += a[i]
for i in a:
	if i >= x * 1 / (4 * m):
		ans += 1
if ans >= m:
	print('Yes')
else:
	print('No')


(N, M, *A) = map(int, open(0).read().split())
A.sort()
if all((a >= sum(A) / (4 * M) for a in A[-M:])):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
ls = list(map(int, input().split()))
ls = sorted(ls, reverse=True)
print('Yes' if ls[m - 1] * 4 * m >= sum(ls) else 'No')


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = sum(a)
c = sorted(a)
d = b / 4 / m
if c[-m] >= d:
	print('Yes')
else:
	print('No')


def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(map(int, input().split()))

def i_row(N):
	return [int(input()) for _ in range(N)]

def i_row_list(N):
	return [list(map(int, input().split())) for _ in range(N)]
(na, m) = i_map()
aa = i_list()
cnt = 0
aa.sort(reverse=True)
for i in range(m):
	if aa[i] * 4 * m >= sum(aa):
		cnt += 1
if cnt == m:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
c = sum(a) / (4 * M)
print('Yes' if a[M - 1] >= c else 'No')


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)
if all([x >= total / (4 * m) for x in a[:m]]):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
votes = sum(A)
tot = 0
for i in range(n):
	std = votes * (1 / (4 * m))
	if A[i] < std:
		continue
	tot += 1
if tot >= m:
	print('Yes')
else:
	print('No')


from typing import List

def answer(n: int, m: int, a: List[int]) -> str:
	ref_value = sum(a) / (4 * m)
	result = len(list((i for i in a if ref_value <= i)))
	return 'Yes' if m <= result else 'No'

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	print(answer(n, m, a))

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in range(m):
	if l[i] < sum(l) / (4 * m):
		print('No')
		return
	else:
		continue
print('Yes')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
S = sum(A)
if A[-m] < S / (4 * m):
	print('No')
else:
	print('Yes')


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
std = sum(a) * (1 / (4 * m))
cnt = 0
for i in range(n):
	if a[i] >= std:
		cnt += 1
if cnt >= m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
aa = sum(a)
count = 0
for i in range(len(a)):
	if a[i] >= aa * (1 / (4 * m)):
		count += 1
	else:
		pass
if count >= m:
	print('Yes')
else:
	print('No')


(_, m, *a) = map(int, open(0).read().split())
s = sum(a)
print('No' if m > sum((s <= 4 * m * i for i in a)) else 'Yes')


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
import sys
import math
import collections
(n, m) = L()
a = L()
h = sum(a) / (4 * m)
a.sort(reverse=True)
for i in range(m):
	if a[i] < h:
		print('No')
		return
print('Yes')


f = lambda : map(int, input().split())
(_, m) = f()
l = sorted(list(f()))
print(['No', 'Yes'][l[-m] * 4 * m >= sum(l)])


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
sa = sum(A)
print('Yes' if len([a for a in A if a >= sa / (4 * m)]) >= m else 'No')


from sys import stdin, stdout
for _ in range(1):
	(n, m) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	a.sort(reverse=True)
	sm = sum(a)
	c = 0
	lim = 4 * m
	lim = 1 / lim * sm
	for i in range(n):
		if a[i] < lim:
			break
		c += 1
	print('Yes' if c >= m else 'No')


(n, m, *a) = map(int, open(0).read().split())
s = sum(a)
print('YNeos'[sum((i * 4 * m >= s for i in a)) < m::2])


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
get = 0
count = 0
for i in a:
	get += i
for i in a:
	if i * 4 * m >= get:
		count += 1
if count >= m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = a[::-1]
if b[m - 1] < sum(a) / (4 * m):
	print('No')
elif True:
	print('Yes')


(n, m) = map(int, input().split())
l = sorted(map(int, input().split()), reverse=True)
print(['No', 'Yes'][l[m - 1] * 4 * m >= sum(l)])


(N, M, *A) = map(int, open(0).read().split())
A.sort()
if A[-M] * 4 * M >= sum(A):
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
a = list(map(int, input().split()))
border = sorted(a)[-M]
print('Yes' if border >= sum(a) / (4 * M) else 'No')


(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
x = sum(A)
for i in range(M):
	if 4 * M * A[i] < x:
		print('No')
		break
else:
	print('Yes')


import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp
INF = inf
MOD = 1000000007
(n, m) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
tmp = 0
res = 'No'
A = sorted(A, reverse=True)
if A[m - 1] * m * 4 >= sum(A):
	res = 'Yes'
print(res)


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
B = [i for i in A if i >= sum(A) / (4 * M)]
print('Yes' if len(B) >= M else 'No')


(x, y) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
if l[y - 1] >= sum(l) / (4 * y):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l_sorted = sorted(l, reverse=True)
border = sum(l) / (4 * m)
temp = []
for i in range(m):
	if border <= l_sorted[i]:
		temp.append(1)
print('Yes' if sum(temp) == m else 'No')


(n, m) = map(int, input().split())
in_list = input().split()
vote_list = [int(i) for i in in_list]
ans = 0
for ai in vote_list:
	if ai >= 1 / (4 * m) * sum(vote_list):
		ans += 1
if ans < m:
	print('No')
else:
	print('Yes')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
a.sort(reverse=True)
for i in range(m):
	if a[i] < s / (4 * m):
		print('No')
		return
print('Yes')


(N, M) = map(int, input().split())
vote = list(map(int, input().split()))
sum = 0
for i in range(N):
	sum += vote[i]
check = sum / (4 * M)
cnt = 0
for j in range(N):
	if vote[j] >= check:
		cnt += 1
if cnt >= M:
	print('Yes')
else:
	print('No')


(N, M) = list(map(int, input().split()))
A_list = list(map(int, input().split()))
A_list.sort(reverse=True)
check_num = A_list[M - 1]
if check_num / sum(A_list) >= 1 / (4 * M):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
print('YNeos'[sum((a[i] >= sum(a) / (4 * m) for i in range(m))) < m::2])


(N, M, *A) = map(int, open(0).read().split())
S = sum(A) / (4 * M)
print('YNeos'[not sum((a >= S for a in A)) >= M::2])


(N, M) = [int(s) for s in input().split()]
ls = [int(s) for s in input().split()]
ls = sorted(ls, reverse=True)
border = sum(ls) / (4 * M)
if ls[M - 1] >= border:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=1)
s = sum(l)
if l[m - 1] >= s / (4 * m):
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
B = sorted(A)[::-1]
if B[M - 1] >= S / (4 * M):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = map(int, input().split())
a = sorted(a)
if a[-m] >= sum(a) / 4 / m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
print('YNeos'[len([x for x in a if x >= sum(a) / 4 / m]) < m::2])


f = lambda : map(int, input().split())
(_, m) = f()
l = sorted(f())
print('YNeos'[l[-m] * 4 * m < sum(l)::2])


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
k = sum(a)
l = list()
for i in range(n):
	if a[i] >= k / (4 * m):
		l.append(a[i])
if len(l) >= m:
	print('Yes')
else:
	print('No')


def __starting_point():
	(n, m) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	get_A = sum(A) / (4 * m)
	ans = 0
	for i in A:
		if get_A > i:
			continue
		ans += 1
	if ans >= m:
		print('Yes')
	else:
		print('No')
__starting_point()


(N, M) = map(int, input().split())
A = input()

def ans161(N: int, M: int, A: str):
	A = sorted(list(map(int, A.split())))
	if A[-M] < sum(A) / (4 * M):
		return 'No'
	else:
		return 'Yes'
print(ans161(N, M, A))


(n, m) = map(int, input().split())
a = [*map(int, input().split())]
t = sum(a) / (4 * m)
print('YNeos'[sum([i >= t for i in a]) < m::2])


(n, m) = list(map(int, input().split()))
arr = list(map(int, input().split()))
th = sum(arr) * (1 / (4 * m))
ans = 'No'
cnt = 0
for x in arr:
	if th <= x:
		cnt += 1
		if cnt == m:
			ans = 'Yes'
			break
print(ans)


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
print('Yes' if len([x for x in a if x >= sum(a) / (4 * m)]) >= m else 'No')


(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
A.reverse()
s = 0
cnt = 0
for i in range(n):
	s += A[i]
for i in range(m):
	if A[i] >= s / (4 * m):
		cnt += 1
if cnt == m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
x = sum(A) * 1 / (4 * m)
A = [i for i in A if i >= x]
print('Yes' if len(A) >= m else 'No')


(n, m, *a) = map(int, open(0).read().split())
print('YNeos'[sorted(a)[-m] * 4 * m < sum(a)::2])


(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
sum = 0
for i in A:
	sum += i
A.sort(reverse=True)
if A[m - 1] >= sum / (4 * m):
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
A = [int(x) for x in input().split()]
lim = sum(A) / (4 * m)
print(['No', 'Yes'][sum((a >= lim for a in A)) >= m])


import sys
(N, M) = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
all_vote = sum(A)
for i in range(M):
	if A[i] < all_vote / (4 * M):
		print('No')
		return
print('Yes')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
print(['Yes', 'No'][a[n - m] < sum(a) / 4 / m])


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
flag = 0
for i in range(n):
	if l[i] >= sum(l) / (4 * m):
		if n - i >= m:
			print('Yes')
		else:
			print('No')
		flag = 1
		break
if flag == 0:
	print('No')


(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
sum_A = sum(A)
for i in range(M):
	if A[i] < sum_A / (4.0 * M):
		print('No')
		return
print('Yes')


(n, m) = map(int, input().split())
alist = list(map(int, input().split()))
print('Yes' if sum([1 if 4 * m * c >= sum(alist) else 0 for c in alist]) >= m else 'No')


import decimal
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
base = sum(A) / (4 * M)
for Ai in A:
	if Ai >= base:
		cnt += 1
if cnt >= M:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
As = list(map(int, input().split()))
print('Yes' if len([a for a in As if a >= sum(As) / (4 * M)]) >= M else 'No')


(N, M) = map(int, input().split())
A = sorted(map(int, input().split()))
print(['No', 'Yes'][A[-M] >= sum(A) / (4 * M)])


(N, M) = map(int, input().split())
L = list(map(int, input().split()))
c = sum(L)
L = sorted(L, reverse=True)
if c / (4 * M) > L[M - 1]:
	print('No')
else:
	print('Yes')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
print('YNeos'[A[M - 1] < sum(A) / 4 / M::2])


(a, b) = map(int, input().split())
List = list(map(int, input().split()))
List = sorted(List)
c = List[-b]
print('Yes' if c >= sum(List) / (4 * b) else 'No')


def __starting_point():
	(N, M) = list(map(int, input().split()))
	li = list(map(int, input().split()))
	lisum = sum(li)
	cnt = 0
	for i in range(N):
		if lisum / (M * 4) <= li[i]:
			cnt += 1
	if M <= cnt:
		print('Yes')
	else:
		print('No')
__starting_point()


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
t = sum(l) / (4 * b)
ans = [i for i in l if i >= t]
print('Yes' if len(ans) >= b else 'No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
m = sum(A) / (4 * M)
n = sum([1 for i in A if i >= m])
print(['No', 'Yes'][n >= M])


from numpy import cumsum
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
result = cumsum(a)[-1]
mi = result / (4 * m)
ans = 0
for i in range(n):
	if a[i] >= mi:
		ans += 1
if ans >= m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
print('NYoe s'[m <= len([i for i in A if i >= sum(A) / (4 * m)])::2])


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
ok = [item for item in A if item >= sum(A) / (4 * M)]
if len(ok) >= M:
	print('Yes')
else:
	print('No')


(n, m) = list(map(int, input().split()))
a = sorted([int(x) for x in input().split()])
a.reverse()
s = 0
for x in a:
	s += x
print('Yes' if a[m - 1] >= (s + 4 * m - 1) // (4 * m) else 'No')


N = list(map(int, input().split()))
A = list(map(int, input().split()))
sorted_A = sorted(A, reverse=True)
sum_A = sum(A)
flag = 0
for i in range(N[1]):
	if sorted_A[i] >= sum_A / (4 * N[1]):
		flag = 1
	else:
		flag = 0
if flag == 1:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
d = s * (1 / (4 * m))
t = sum((a >= d for a in A))
print('Yes' if t >= m else 'No')


(a, b) = map(int, input().split())
n = list(map(int, input().split()))
n.sort()
n.reverse()
if sum(n) / (4 * b) > n[b - 1]:
	print('No')
else:
	print('Yes')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
vote = sum(A)
for i in range(N):
	if A[i] >= vote / (4 * M):
		A[i] = 1
	else:
		A[i] = 0
if M <= sum(A):
	print('Yes')
else:
	print('No')


def iparse():
	return list(map(int, input().split()))
(n, m) = iparse()
a = iparse()
s = sum(a)
k = (s + 4 * m - 1) // (4 * m)
cnt = 0
for e in a:
	if e >= k:
		cnt += 1
print('Yes' if cnt >= m else 'No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
l = [1 for i in a if i * 4 * m >= sum(a)]
print('Yes' if len(l) >= m else 'No')


(n, m) = list(map(int, input().split()))
li = list(map(int, input().split()))
ans = 0
q = sorted(li, reverse=True)
for i in range(m):
	if q[i] * 4 * m >= sum(li):
		ans += 1
if ans == m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
li = list(map(int, input().split()))
li.sort(reverse=True)
sum = 0
cnt = 0
for i in li:
	sum += i
for i in range(m):
	if li[m - 1] * 4 * m >= sum:
		cnt += 1
if cnt == m:
	print('Yes')
else:
	print('No')


(n, m) = map(int, input().split())
(*arr,) = map(int, input().split())
arr.sort()
s = sum(arr)
print('Yes' if 4 * m * arr[-m] >= s else 'No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
j = sum(a) / 4 / m
p = 0
for i in a:
	if i >= j:
		p += 1
if p >= m:
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
c = 0
for i in A:
	if S <= i * 4 * M:
		c += 1
print('Yes' if c >= M else 'No')


(N, M) = list(map(int, input().split()))
lst = list(map(int, input().split()))
lst.sort()
if lst[0 - M] * 4 * M >= sum(lst):
	print('Yes')
else:
	print('No')


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
AM = A[0:M]
asum = sum(A)
rate = asum / 4 / M
for idx in AM:
	if idx < rate:
		print('No')
		break
else:
	print('Yes')


def resolve():
	(n, m) = map(int, input().split())
	a = sorted(list(map(int, input().split())), reverse=True)
	print('Yes' if a[m - 1] >= sum(a) / 4 / m else 'No')
resolve()