Help needed in approach

We are given n which denotes the number of colours and an array which indicates the number of socks of that colour . Find the minimum possible picks required to get at least K pairs in the worst case. Here pick means to pick a sock ( we don’t know the colour of it) and we can form a pair between socks of same colour test case: 3 1 3 2 output :6 that is we need to pick all the socks . Can anyone explain their approach ?

Can you share the question link?

@elli0t it is asked in csacademy in hourly contests cant share the link because the link will be expired.