#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> count(N + 1, 0);
  vector<long long> x;
  vector<long long> y;
  long long x_tmp, y_tmp;
  for (long long i = 0; i < (long long)(M); i++) {
    cin >> x_tmp >> y_tmp;
    count[x_tmp]++;
    count[y_tmp]++;
    x.push_back(x_tmp);
    y.push_back(y_tmp);
  }
  if (M % 2 != 0) {
    cout << -1 << endl;
    return 0;
  }
  return 0;
}
