K ->pi pi decays in a finite volume