Изменения
→Псевдокод
'''for''' i = 1 '''to''' n
'''if''' i <= k
a[i] = 1;
'''else'''
a[i] = 0; random_shuffle(a);
'''for''' i = 1 '''to''' n
'''if''' a[i] == 1
ans.push(arrayOfElement[i]); '''return''' ans;
</code>