#P6596. How Many of Them

How Many of Them

Problem Description

In an undirected connected graph, if removing an edge makes the graph split into two disconnected parts, then this edge is called a bridge.

Find the number of undirected connected graphs that satisfy the following conditions:

  1. The graph consists of nn labeled vertices.

  2. The number of bridges is at most mm.

  3. There are no multiple edges and no self-loops.

Output the answer modulo 109+710^{9}+7.

Input Format

Only one line with two integers nn and mm.

Output Format

One integer, representing the answer.

3 3
4
5 1
453

Hint

Constraints: 2n502 \le n \le 50, 0mn(n1)20 \le m \le \dfrac{n(n-1)}{2}.

Source: Gennady Korotkevich (tourist), ITMO University.

Translated by ChatGPT 5