#include using namespace std; int main(){ int n,k; cin >> n >> k; if(k==0){ cout << -1 << endl; } else { cout << k+2*(n-k) << endl; for(int i=0;i