#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 5;
int n, m;
pair<int, int> edge[MAX_N];
vector<int> G[MAX_N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> edge[i].first >> edge[i].second;
    edge[i].first--, edge[i].second--;
    G[edge[i].first].push_back(i);
    G[edge[i].second].push_back(i);
  }
  if (n & 1) {
    cout << "-1\n";
    return 0;
  }
  exit(-1);
  return 0;
}
