A molecular sieve: sorting particles by size