Problem:


Score : 200 points

Problem Statement

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 1

4 1
5 4 2 1

Sample Output 1

Yes

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

Sample Input 2

3 2
380 19 1

Sample Output 2

No

There were 400 votes in total. The second and third most popular items received less than \dfrac{1}{4\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.

Sample Input 3

12 3
4 56 78 901 2 345 67 890 123 45 6 789

Sample Output 3

Yes



Sample input:
4 1
5 4 2 1


Sample output:
Yes

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
b = (sum(A)-1)//(4*m)

if sum([A[i] > b for i in range(n)]) >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
    N,M = map(int,input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)
    S = sum(A)
    border = S / (4 * M)
    flag = True
    for i in range(M):
        if border > A[i]:
            flag = False
    if flag:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
num = list(map(int, input().split()))
SumVote = sum(num)
cnt = 0
for i in num:
  if i*4*m >= SumVote:
    cnt += 1
if cnt >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))

count = 0
sum_vote = sum(a)

for i in a:
    if i >= sum_vote/(4*m):
        count += 1

if count >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort(reverse=True)
total = sum(A)
ans = 0
for a in A:
    if a * 4 * M >= total:
        ans += 1
print('Yes' if ans >= M else 'No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))

al = sum(a)
count = 0
for i in range(n):
	if a[i] >=al/(4*m):
		count += 1

if count >= m:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, m, *a = map(int, open(0).read().split())
a.sort(reverse=True)
s = sum(a)/(4*m)
cant = False
for i in range(m):
	if a[i]<s: cant = True
print("YNeos"[cant::2])

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
N,M = list(map(int, input().split()))
A_list = list(map(int, input().split()))

border = sum(A_list)/(4*M)
cnt= 0
for a in A_list:
    if a >= border:
        cnt += 1

if cnt >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N,M = LMIIS()
    A = LMIIS()
    count = 0
    sum_vote = sum(A)
    for a in A:
        if a * 4 * M >= sum_vote:
            count += 1
    YN(count >= M)
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

A = sorted(A, reverse=True)
sumA = sum(A)
b = sumA / (4*M)

if A[M-1] < b:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
ans=[]
border=sum(A)/(4*M)

for i in A:
    if i>=border:
        ans.append(i)
    else:
        pass
print("Yes" if len(ans)>=M else "No")

Submission status: Accepted

Solution code:
#B
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = a[m-1]
total = sum(a)
if ans < total/(4*m):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sumA = sum(A)
rankM = list(reversed(sorted(A)))[M-1]
#print(sumA, rankM)
if rankM * 4 * M < sumA:
  print('No')
else:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

s = sum(A)
res = 0
tmp = sorted(A,reverse=True)

c = s/(4*M)
for i in range(M):
    if c > tmp[i]:
        print('No')
        sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
count = 0
for i in a:
  if 1/(4*m) <= i/s:
    count+=1

if count >= m:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n,m = map(int, readline().split())
  a = list(map(int, readline().split()))
  total = sum(a)
  count = 0
  for i in a:
    if i>=total/(4*m):
      count +=1
  if count>=m:
    print('Yes')
  else:
    print('No')
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
ans = 0
for a in A:
    if a >= S / (4 * m):
        ans += 1
if ans >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#coding:utf-8

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

Submission status: Accepted

Solution code:
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
total = sum(A)
th = total/4/M
Asorted = sorted(A, reverse=True)
flag = 0
for i in range(M):
  if(Asorted[i] < th):
    flag = 1
if(flag==0):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
from math import ceil
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
 
# for i in range(int(ri())):
n,m = RI()
a = RI()
summ = sum(a)
cnt = ceil(summ/(4*m))
tot = 0
for i in range(len(a)):
    if a[i] >= cnt:
        tot+=1
if tot >= m:
    Yes()
else:
    No()

Submission status: Accepted

Solution code:
import sys,math,copy,queue,itertools,bisect
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
N,M = LI()
A = LI()
A.sort(reverse=True)
s = sum(A)
for i in range(M):
    if A[i] < s / (4 * M):
        print ('No')
        exit (0)
print ('Yes')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
data = list(map(int, input().split()))

data.sort(reverse=True)
if data[m - 1] >= sum(data) / (4 * m):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    votes = list(map(int, input().split()))

    sum_vote = sum(votes)
    filter_list = list(filter(lambda x : x >= sum_vote / (4 * m), votes))

    if len(filter_list) >= m:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
arr = list(map(int, input().split()))
temp = sum(arr)/(4 * m)
cnt = 0
for i in range(n):
    if arr[i] >= temp:
        cnt += 1
if cnt >= m:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


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


if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
import math

N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

sumA = 0
for i in range(N):
  sumA += A[i]

can_be_chosen = 0
for i in range(N):
  if A[i] >= sumA/4.0/M:
    can_be_chosen += 1

if can_be_chosen >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

threshold = sum(A) / (4 * M)
if len([a for a in A if a >= threshold]) >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

sousu = sum(a)

eraberu = 0
for i in range(n):
    if a[i] >= sousu / (4 * m):
        eraberu += 1

if eraberu >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
A.sort(reverse=True)
yes = sum(a * 4 * M >= s for a in A) >= M
print('Yes' if yes else 'No')

Submission status: Accepted

Solution code:
import math

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

num = sum(A)
cnt = 0
for a in A:
    if (a >= num/(4*M)):
        cnt += 1

if (M<=cnt):    
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import numpy as np

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

target = np.sum(A)
ans = 0
for i in range(N):
    if A[i] >= target/(4*M):
        ans += 1
print('Yes') if ans >= M else print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 print('No')

Submission status: Accepted

Solution code:
from math import ceil
N, M = map(int, input().split())
As = list(map(int, input().split()))
lim = ceil(sum(As)/(4*M))
OK = [a for a in As if a>=lim]
if len(OK)>=M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = [int(x) for x in input().split()]
items = tuple(int(x) for x in input().split())
threshould = sum(items) / 4 / m
chosen = 0
for i in items:
    if i >= threshould:
        chosen += 1
    if chosen >= m:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,m=map(int, readline().rstrip().split())
    aa=list(map(int, readline().rstrip().split()))
    aa=sorted(aa,reverse=True)
    sth=sum(aa)
    yn(aa[m-1]>=sth/(4*m))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
k=sum(a)/(4*m)
s=0
for i in range(m):
    if a[-i-1]>=k:
        pass
    else:
        s=1
        break
if s==1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
N,M=map(int, input().split())
li = list(map(int, input().split()))
li = sorted(li, reverse=True)
n_M = sum(li)
cri = n_M/(4*M)

if li[M-1] < cri:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
#n=int(input())
n,m=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

total=sum(al)

thre=total/(4*m)
count=0
for i in range(n):
    if al[i]>=thre:
        count+=1

if count>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
a_list = list(map(int, input().split()))
limit = sum(a_list)*(1/(4*M))
cnt = 0
for i in a_list:
    if i >= limit:
        cnt += 1
print("Yes") if cnt >= M else print("No")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
print(["No", "Yes"][sum(x >= s / 4 / m for x in a) >= m])

Submission status: Accepted

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = list(map(int, input().split()))
    #a = [list(input().split()) for i in range(n)]
    #a = [int(input()) for i in range(n)]
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    x,m=map(int,input().split())
    a=sorted(list(map(int,input().split())),reverse=True)
    if a[m-1] >= sum(a)/(m*4):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sortA = sorted(A, reverse=True)
sumA = sum(A)
flag = True
for i in range(M):
    if sortA[i] < sumA / (4 * M):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N,M = [int(i.strip()) for i in input().split(' ')]
A = [int(i.strip()) for i in input().split(' ')]

S = sum(A)

c = 0
for i in A:
    if i >= S/(4*M):
        c += 1

if c >= M:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = [int(c) for c in input().split()]
As = [int(c) for c in input().split()]
total = sum(As)
thre = total / (4*m)
num = sum(item>=thre for item in As)
if num>=m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    n, m = map(int, input().split())
    arr = list(map(int, input().split()))
    limit = sum(arr) / (4 * m)
    cnt = 0
    for num in arr:
        if num >= limit:
            cnt += 1
        if cnt >= m:
            break

    if cnt >= m:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
miman = sum(A)/(4*M)

for i in range(M):
    if not(A[i] >= miman):
        print('No')
        exit(0)
print('Yes')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
n, m = map(int, input().split()) # 入力が複数
A = [int(i) for i in input().split()]
total = sum(A)

cond = total / (4 * m)
ans = 0
for a in A:
    if a >= cond:
        ans += 1
if ans >= m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)

for i in a[:m]:
    if i < sum(a)/(4*m):
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

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

s = sum(A)
k = s/float(4*M)
cnt = 0
for a in A:
    if a >= k:
        cnt += 1

if cnt >= M: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
N,M = map(int,input().split())
A = [int(i) for i in input().split()]

a = sum(A)

b = 0
for i in range(len(A)):
  if A[i] >= a/(4*M):
    b += 1

if b >= M:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, m = [int(s) for s in input().strip().split()]
    A = [int(s) for s in input().strip().split()]
    s = sum(A)
    A.sort()
    if A[-m] * 4 * m >= s:
        print("Yes")
    else:
        print("No")


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def resolve():
    N, M = map(int, input().split())
    arr = sorted(list(map(int, input().split())), reverse=True)
    s = sum(arr)
    th = s / 4 / M
    ans = 'Yes'
    for i in range(M):
        if arr[i] < th:
            ans = 'No'
            break
    print(ans)

resolve()

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
s=sum(A)
c=0
for i in range(N):
  if A[i]>=s/(4*M):
    c+=1
if c>=M:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
cnt = 0
for i in a:
    if i >= sum(a)*(1/(4*m)):
        cnt += 1

if cnt >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)

ng = 0
for i in range(m):
    if a[i] < sum(a) * (1 / (4 * m)):
        ng = 1
print("Yes" if not ng else "No")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
vote = sum(a)
a.sort()
if a[n-m] >= vote / (4*m):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
bound = (1 / (4*M))*sum(A)

for i in range(M):
    if A[i] < bound:
        print("No")
        break
else:
    print("Yes")

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
A = list(map(int,input().split()))

A.sort(reverse = True)
total = sum(A)

if A[M-1] >= total / (4*M):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = np.array(lr(), np.int32)
total = A.sum()
A *= 4*M
count = (A >= total).sum()
bl = count >= M
print('Yes' if bl else 'No')

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=list(map(int,input().split()))
t=sum(A)
r=0
for i in range(n):
    if 4*m*A[i]>=t:
        r+=1
if r>=m:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
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('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
su=sum(A)
th=su/(4*M)
ans=0
for i in A:
    if not(i <th):
        ans+=1
if ans>=M:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N,M =map(int,input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  if A[i] >= sum(A) / 4 / M :
    ans +=1
print ("Yes" if ans>=M else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))

wa = sum(a)
ans = 0
for i in range(n):
    if a[i] >= wa / (4 * m):
        ans +=1
if ans >= m:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
A_list = list(map(int, input().split()))

min_vote_line = sum(A_list) / (4 * M)
ans_list = [i for i in A_list if i >= min_vote_line]

print("Yes" if len(ans_list) >= M else "No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

     s = sum(a)
     line = s / (4 * m)

     a = sorted(a, reverse=True)
     # print(a)
     if a[m-1] >= line:
          print('Yes')
     else:
          print('No')

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, M = read_int()
A = read_int()


def solve():
    ans = 'No'
    res = 0
    all = sum(A)
    for a in A:
        if a >= all / (4 * M):
            res += 1
    if res >= M:
        ans = 'Yes'
    return ans

if __name__ == "__main__":
    print(solve())