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