#include <bits/stdc++.h>
using namespace std;
vector<int> vertex[200000];
int ans = 0;
int lets_go(int a, int comed) {
  int doing = 1;
  for (int i = 0; i < vertex[a].size(); ++i) {
    if (vertex[a][i] != comed) {
      if (lets_go(vertex[a][i], a) == 1) {
        doing += 1;
        ans++;
      }
    }
  }
  return doing % 2;
}
int main() {
  int n, m;
  cin >> n >> m;
  if (n - 1 != m) {
    cout << "Cant Execute" << endl;
    return 0;
  }
  if (n % 2 == 1) {
    cout << "-1" << endl;
    return 0;
  }
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    vertex[a].push_back(b);
    vertex[b].push_back(a);
  }
  lets_go(1, 0);
  cout << ans << endl;
}
