#include<stdio.h>
#include<stdlib.h>

int **matrix, *seq, *art, counter;

int Biconnected(int, int);
int main(void)
{
  int i, v, e, s, t;
  scanf("%d %d", &v, &e);
  matrix = (int**)malloc(sizeof(int*) * v);
  seq = (int*)calloc(v, sizeof(int));
  art = (int*)calloc(v, sizeof(int));
  for (i = 0; i < v; i++) matrix[i] = (int*)calloc(v, sizeof(int));
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    matrix[s][t] = 1;
    matrix[t][s] = 1;
  }
  Biconnected(0, v);
  for (i = 0; i < v; i++) {
    if (art[i]) printf("%d\n", i);
    free(matrix[i]);
  }
  free(matrix);
  free(seq);
  free(art);
}
int Biconnected(int point, int v)
{
  int i, min;
  counter++;
  seq[point] = counter;
  min = counter;
  for(i = 0; i < v; i++) {
    if (!matrix[point][i]) continue;
    if (!seq[i]) {
      int m;
      m = Biconnected(i, v);
      if (m < min) min = m;
      if (seq[point] == 1) {
        if (seq[i] != 2) {
          art[point] = 1;
        }
      }else {
        if (m >= seq[point]) {
          art[point] = 1;
        }
      }
    } else if (seq[i] < min) {
      min = seq[i];
    }
  }
  return min;
}
