The isoperimetric problem for nonlocal perimeters