90% fail this challenge? I guess I'm not the only one who have seen this kind of image on Facebook (and other sites). 



The picture above was posted 16 days ago, and has accumulated 51 k comments. Some answers: 0, 4, 8, 48, 88, 120, 124 and so on.

Challenge:

The mathematics in the question doesn't make sense1, so we can't find the correct answer by looking at the equation (or whatever you'd call that mess of numbers and operators). However, there's a very large number of people who have answered, and 10% of those people are right!

Let's find the right answer!



Take an integer, percent, decimal value in 0-1, or fraction N representing how many percent of the test group who failed the question (or optionally how many answered correctly), and a list of numbers representing the answers people post.

Find the number that 100-N percent of the test group answered and output it. If there are more than one answer that matches this criterion, then you must output all of them.
If there are no answers that are represented 100-N percent of the time then you must output the number that's closest (measured in number of answers from 100-N).

To make the input rules for N clear: If 90 % fails, then you may input 90, 10, 0.9 or 0.1. You must specify which one you choose. You may assume that the percentage numbers are integers.



Test cases:

In the test cases below, N is the percentage that failed the test. You may choose to input using any of the allowed input methods.

N:  90   (meaning 90 % will fail and 10 % answer correctly)
List: 3 1 5 6 2 1 3 3 2 6
Output: 5   (because 90 % of the answers weren't 5)
---
N:  50   (50 % will answer correctly)
List: 3 6 1 6
Output: 6   (because 50 % of the answers weren't 6)
---
N:  69   (31 % will answer correctly)
List: 1 9 4 2 1 9 4 3 5 1 2 5 2 4 4 5 2 1 6 4 4 3
Output: 4    (because 31% of 22 is 6.82. There are 6 fours, which is the 
              closest to 6.82)
---
N = 10   (90 % will answer correctly)
List: 1 2 3 4 5 6 7 8 9 10
Output: 1 2 3 4 5 6 7 8 9 10 (because 9/10 will answer correctly. All numbers
                              have been answered the same number of times, thus
                              all are equally likely to be correct.
---
N:  90
List: 1 1 1
Output: 1






code-golf

1 Please don't argue with me here. If you "know" the answer, join the other 10% and post it on Facebook!
MATL, 16 14 bytes

-1 byte thanks to @Giuseppe

-1 byte thanks to @LuisMendo

SY'ts/i-|tX&lt;=)


Explanation:

        % implicit input
S       % sort
Y'      % run-length encoding
ts      % duplicate elements and sum (get number of elements)
/       % array right division (get array of probability for each answer)
i-|     % get absolute difference with second input
tX&lt;     % duplicate and get minimum value
=)      % get each answer that match with the minimum value
        % (implicit) convert to string and display


Try it online! or verify all test cases