Nonlocal problems in Hilbert spaces