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

struct node {
  int id;
  struct node *next;
};
struct node **list;
int *seq, *art, counter;

void Insert(int, int);
int Biconnected(int);
int main(void)
{
  int i, v, e, s, t;
  scanf("%d %d", &v, &e);
  list = (struct node**)malloc(sizeof(struct node*) * v);
  art = (int*)calloc(v, sizeof(int));
  seq = (int*)calloc(v, sizeof(int));
  for (i = 0; i < v; i++) {
    list[i] = NULL;
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(s,t);
  }
  Biconnected(0);
  for (i = 0; i < v; i++) {
    if (art[i]) printf("%d\n", i);
    free(list[i]);
  }
  free(list);
  free(seq);
  free(art);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->next = list[a];
  list[a] = p;
  p = (struct node*)malloc(sizeof(struct node));
  p->id = a;
  p->next = list[b];
  list[b] = p;
}
int Biconnected(int point)
{
  int min;
  struct node *n;
  counter++;
  seq[point] = counter;
  min = counter;
  for(n = list[point]; n != NULL; n = n->next) {
    if (!seq[n->id]) {
      int m;
      m = Biconnected(n->id);
      if (m < min) min = m;
      if (seq[point] == 1) {
        if (seq[n->id] != 2) {
          art[point] = 1;
        }
      }else {
        if (m >= seq[point]) {
          art[point] = 1;
        }
      }
    } else if (seq[n->id] < min) {
      min = seq[n->id];
    }
  }
  return min;
}
