using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces_Round_629__Div._3_
{
    class E_2
    {
        static (int, int) ReadPairFromLine()
        {
            var data = Console
                .ReadLine()
                .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();
            return (data[0], data[1]);
        }

        static int[] ReadQueryFromLine() =>
                Console
                    .ReadLine()
                    .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToArray();

        class Entry
        {
            public List<int> children = new List<int>();
            public int parent;
            public int pathLength;
        }

        static Entry[] g;

        static void ReadGraph(int n)
        {
            g = new Entry[n + 1];  // index 0 is unused
            var numEdges = n - 1;

            for (int i = 0; i < numEdges; i++)
            {
                var (u, v) = ReadPairFromLine();

                g[u] = g[u] ?? new Entry();
                g[u].children.Add(v);

                g[v] = g[v] ?? new Entry();
                g[v].children.Add(u);
            }

            g[1].pathLength = 1;

            var s = new Stack<(int, int)>();
            s.Push((1, 2));

            while (s.Count > 0)
            {
                var (curParentIdx, curPathLength) = s.Pop();
                foreach (var childIdx in g[curParentIdx].children)
                {
                    var child = g[childIdx];
                    child.parent = curParentIdx;
                    child.children.Remove(curParentIdx);
                    child.pathLength = curPathLength;
                    s.Push((childIdx, curPathLength + 1));
                }
            }
        }

        class EntryPathLengthComparer_Desc : IComparer<int>
        {
            public int Compare(int x, int y)
            {
                return g[y].pathLength - g[x].pathLength;
            }
        }

        static void HandleQuery(int[] queryVertices)
        {
            Array.Sort(queryVertices, 1, queryVertices[0], new EntryPathLengthComparer_Desc());

            var deepestVerticePath = GetPathFor(queryVertices[1]);
            var k1 = queryVertices[0] - 1;
            var ok = true;

            for (int i = k1; i >= 1
                && (ok = CloseEnough(deepestVerticePath, GetPathFor(queryVertices[1 + i])))
                ; i--)
            { }
            Console.WriteLine(ok ? "YES" : "NO");
        }

        static List<int> GetPathFor(int node) {
            var path = new List<int>();
            do
            {
                path.Add(node);
                node = g[node].parent;
            }
            while (node != 0);

            path.Reverse();
            return path;
        }

        static bool CloseEnough(List<int> deepPath, List<int> shortPath)
        {
            var c1 = shortPath.Count - 1;
            for (int i = 0; i < c1; i++)
            {
                if (deepPath[i] != shortPath[i])
                {
                    return false;
                }
            }
            return true;
        }

        static void Main(string[] args)
        {
            var (n, m) = ReadPairFromLine();
            ReadGraph(n);

            for (int i = 0; i < m; i++)
            {
                HandleQuery(ReadQueryFromLine());
            }

            //Console.WriteLine("END");
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces_Round_629__Div._3_
{
    class E_2
    {
        static (int, int) ReadPairFromLine()
        {
            var data = Console
                .ReadLine()
                .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();
            return (data[0], data[1]);
        }

        static int[] ReadQueryFromLine() =>
                Console
                    .ReadLine()
                    .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToArray();

        class Entry
        {
            public List<int> children = new List<int>();
            public int parent;
            public int pathLength;
        }

        static Entry[] g;

        static void ReadGraph(int n)
        {
            g = new Entry[n + 1];  // index 0 is unused
            var numEdges = n - 1;

            for (int i = 0; i < numEdges; i++)
            {
                var (u, v) = ReadPairFromLine();

                g[u] = g[u] ?? new Entry();
                g[u].children.Add(v);

                g[v] = g[v] ?? new Entry();
                g[v].children.Add(u);
            }

            g[1].pathLength = 1;

            var s = new Stack<(int, int)>();
            s.Push((1, 2));

            while (s.Count > 0)
            {
                var (curParentIdx, curPathLength) = s.Pop();
                foreach (var childIdx in g[curParentIdx].children)
                {
                    var child = g[childIdx];
                    child.parent = curParentIdx;
                    child.children.Remove(curParentIdx);
                    child.pathLength = curPathLength;
                    s.Push((childIdx, curPathLength + 1));
                }
            }
        }

        class EntryPathLengthComparer_Desc : IComparer<int>
        {
            public int Compare(int x, int y)
            {
                return g[y].pathLength - g[x].pathLength;
            }
        }

        static void HandleQuery(int[] queryVertices)
        {
            Array.Sort(queryVertices, 1, queryVertices[0], new EntryPathLengthComparer_Desc());

            var deepestVerticePath = GetPathFor(queryVertices[1]);
            var k1 = queryVertices[0] - 1;
            var ok = true;

            for (int i = k1; ok && i >= 1; i--)
            {

                if (!CloseEnough(deepestVerticePath, GetPathFor(queryVertices[1 + i])))
                {
                    ok = false;
                }
            }
            Console.WriteLine(ok ? "YES" : "NO");
        }

        static Dictionary<int, List<int>> pathCache = new Dictionary<int, List<int>>();

        static List<int> GetPathFor(int node)
        {
            if (pathCache.ContainsKey(node))
            {
                return pathCache[node];
            }
            var path = new List<int>();
            do
            {
                path.Add(node);
                node = g[node].parent;
            }
            while (node != 0);

            path.Reverse();
            pathCache[node] = path;
            return path;
        }

        //static Dictionary<long, bool> closeEnoughCache = new Dictionary<long, bool>();

        static bool CloseEnough(List<int> deepPath, List<int> shortPath)
        {
            return shortPath.Count == 1
                ? true
                : shortPath[shortPath.Count - 2] == deepPath[shortPath.Count - 2];

            //var c1 = shortPath.Count - 1;
            //for (int i = 0; i < c1; i++)
            //{
            //    if (deepPath[i] != shortPath[i])
            //    {
            //        return false;
            //    }
            //}
            //return true;
        }

        static void Main(string[] args)
        {
            var (n, m) = ReadPairFromLine();
            ReadGraph(n);

            for (int i = 0; i < m; i++)
            {
                HandleQuery(ReadQueryFromLine());
            }

            //Console.WriteLine("END");
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces_Round_629__Div._3_
{
    class E_2
    {
        static int[] ReadPairFromLine()
        {
            var res = new int[2];
            var resIdx = 0;
            var acc = 0;
            var s = Console.ReadLine();
            var len = s.Length;

            for (int i = 0; i < len; i++)
            {
                var c = s[i];
                if (c == ' ')
                {
                    res[resIdx++] = acc;
                    acc = 0;
                }
                else
                {
                    acc = acc * 10 + (c - '0');
                }
            }
            res[resIdx++] = acc;
            return res;
        }

        static int[] ReadQueryFromLine()
        {
            var acc = 0;
            var line = Console.ReadLine();
            var len = line.Length;
            int[] res = null;
            int i;

            for (i = 0; i < len; i++)
            {
                if (line[i] == ' ')
                {
                    res = new int[acc + 1];
                    res[0] = acc;
                    break;
                }
                acc = acc * 10 + (line[i] - '0');
            }

            var resIdx = 1;
            acc = 0;
            i++;
            for (; i < len; i++)
            {
                var c = line[i];
                if (c == ' ')
                {
                    res[resIdx++] = acc;
                    acc = 0;
                }
                else
                {
                    acc = acc * 10 + (c - '0');
                }
            }
            res[resIdx++] = acc;

            return res;
        }

        class Entry
        {
            public List<int> children = new List<int>();
            public int parent;
            public int pathLength;
        }

        static Entry[] g;

        static void ReadGraph(int n)
        {
            g = new Entry[n + 1];  // index 0 is unused
            var numEdges = n - 1;

            for (int i = 0; i < numEdges; i++)
            {
                var uv = ReadPairFromLine();
                var u = uv[0];
                var v = uv[1];

                g[u] = g[u] ?? new Entry();
                g[u].children.Add(v);

                g[v] = g[v] ?? new Entry();
                g[v].children.Add(u);
            }

            g[1].pathLength = 1;

            var s = new Stack<(int, int)>();
            s.Push((1, 2));

            while (s.Count > 0)
            {
                var (curParentIdx, curPathLength) = s.Pop();
                foreach (var childIdx in g[curParentIdx].children)
                {
                    var child = g[childIdx];
                    child.parent = curParentIdx;
                    child.children.Remove(curParentIdx);
                    child.pathLength = curPathLength;
                    s.Push((childIdx, curPathLength + 1));
                }
            }
        }

        static void HandleQuery(int[] queryVertices)
        {
            var len = queryVertices.Length;
            var nodeWithMaxPath = queryVertices[1];
            var maxPathLength = g[nodeWithMaxPath].pathLength;

            for (int i = 2; i < len; i++)
            {
                var pl = g[queryVertices[i]].pathLength;
                if (pl > maxPathLength)
                {
                    maxPathLength = pl;
                    nodeWithMaxPath = queryVertices[i];
                }
            }
            var deepestVerticePath = GetPathFor(nodeWithMaxPath);
            var ok = true;

            for (int i = 1; ok && i < len; i++)
            {
                if (queryVertices[i] != nodeWithMaxPath &&
                    !CloseEnough(deepestVerticePath, queryVertices[i]))
                {
                    ok = false;
                }
            }
            Console.WriteLine(ok ? "YES" : "NO");
        }

        static Dictionary<int, List<int>> pathCache = new Dictionary<int, List<int>>();

        static List<int> GetPathFor(int node)
        {
            if (pathCache.ContainsKey(node))
            {
                return pathCache[node];
            }
            var path = new List<int>();
            do
            {
                path.Add(node);
                node = g[node].parent;
            }
            while (node != 0);

            path.Reverse();

            pathCache[node] = path;

            return path;
        }

        static bool CloseEnough(List<int> deepPath, int node)
        {
            return node == 1 || g[node].parent == 1
                ? true
                : g[node].parent == deepPath[g[node].pathLength - 2];
        }

        static void Main(string[] args)
        {
            var nm = ReadPairFromLine();
            ReadGraph(nm[0]);

            var m = nm[1];
            for (int i = 0; i < m; i++)
            {
                HandleQuery(ReadQueryFromLine());
            }

            //Console.WriteLine("END");
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces_Round_629__Div._3_
{
    class E
    {
        static (int, int) ReadPairFromLine()
        {
            var data = Console
                .ReadLine()
                .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();
            return (data[0], data[1]);
        }

        static int[] ReadQueryFromLine() =>
                Console
                    .ReadLine()
                    .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToArray();

        class Entry
        {
            public List<int> children;
            public List<int> path;
        }

        static Dictionary<int, Entry> g = new Dictionary<int, Entry>();

        static void ReadGraph(int numEdges)
        {
            for (int i = 0; i < numEdges; i++)
            {
                var (u, v) = ReadPairFromLine();
                if (g.ContainsKey(u))
                {
                    g[u].children.Add(v);
                }
                else
                {
                    g[u] = new Entry { children = new List<int> { v }, path = new List<int>() };
                }

                if (g.ContainsKey(v))
                {
                    g[v].children.Add(u);
                }
                else
                {
                    g[v] = new Entry { children = new List<int> { u }, path = new List<int>() };
                }
            }

            var s = new Stack<int?>();
            g[1].path.Add(1);
            foreach (var childNo in g[1].children)
            {
                s.Push(childNo);
            }
            var path = new List<int> { 1 };

            while (s.Count > 0)
            {
                var item = s.Pop();
                if (item == null)
                {
                    path.RemoveAt(path.Count - 1);
                    continue;
                }

                var val = item.Value;
                var entry = g[val];

                entry.children.Remove(path[path.Count - 1]);

                path.Add(val);
                entry.path.AddRange(path);

                s.Push(null);
                foreach (var childNo in entry.children)
                {
                    s.Push(childNo);
                }
            }

        }

        static void HandleQuery(int[] queryVertices)
        {
            var sortedByLength =
                queryVertices
                .Skip(1)
                .Select(v => (v, g[v].path.Count))
                .OrderByDescending(t => t.Count)
                .Select(t => t.v)
                .ToArray();

            var deepestVerticePath = g[sortedByLength[0]].path;
            var bound = sortedByLength.Length;
            var ok = true;

            for (int i = 1; i < bound
                && (ok = CloseEnough(deepestVerticePath, g[sortedByLength[i]].path))
                ; i++)
            { }
            Console.WriteLine(ok ? "YES" : "NO");
        }

        static bool CloseEnough(List<int> deepPath, List<int> shortPath)
        {
            var c1 = shortPath.Count - 1;
            for (int i = 0; i < c1; i++)
            {
                if (deepPath[i] != shortPath[i])
                {
                    return false;
                }
            }
            return true;
        }

        static void Main(string[] args)
        {
            var (n, m) = ReadPairFromLine();
            ReadGraph(n - 1);

            for (int i = 0; i < m; i++)
            {
                HandleQuery(ReadQueryFromLine());
            }

            //Console.WriteLine("END");
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces_Round_629__Div._3_
{
    class E_2
    {
        static (int, int) ReadPairFromLine()
        {
            var data = Console
                .ReadLine()
                .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();
            return (data[0], data[1]);
        }

        static int[] ReadQueryFromLine() =>
                Console
                    .ReadLine()
                    .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(int.Parse)
                    .ToArray();

        class Entry
        {
            public List<int> children = new List<int>();
            public int parent;
            public int pathLength;
        }

        static Entry[] g;

        static void ReadGraph(int n)
        {
            g = new Entry[n + 1];  // index 0 is unused
            var numEdges = n - 1;

            for (int i = 0; i < numEdges; i++)
            {
                var (u, v) = ReadPairFromLine();

                g[u] = g[u] ?? new Entry();
                g[u].children.Add(v);

                g[v] = g[v] ?? new Entry();
                g[v].children.Add(u);
            }

            g[1].pathLength = 1;

            var s = new Stack<(int, int)>();
            s.Push((1, 2));

            while (s.Count > 0)
            {
                var (curParentIdx, curPathLength) = s.Pop();
                foreach (var childIdx in g[curParentIdx].children)
                {
                    var child = g[childIdx];
                    child.parent = curParentIdx;
                    child.children.Remove(curParentIdx);
                    child.pathLength = curPathLength;
                    s.Push((childIdx, curPathLength + 1));
                }
            }
        }

        //static string ToString<T>(IEnumerable<T> a) =>
        //    $"[ {string.Join(", ", a.Select(n => n.ToString()))} ]";

        static void HandleQuery(int[] queryVertices)
        {
            var len = queryVertices.Length;
            var nodeWithMaxPath = queryVertices[1];
            var maxPathLength = g[nodeWithMaxPath].pathLength;

            for (int i = 2; i < len; i++)
            {
                var pl = g[queryVertices[i]].pathLength;
                if (pl > maxPathLength)
                {
                    maxPathLength = pl;
                    nodeWithMaxPath = queryVertices[i];
                }
            }
            var deepestVerticePath = GetPathFor(nodeWithMaxPath);
            var ok = true;

            for (int i = 1; ok && i < len; i++)
            {
                if (queryVertices[i] != nodeWithMaxPath &&
                    !CloseEnough(deepestVerticePath, queryVertices[i]))
                {
                    ok = false;
                }
            }
            Console.WriteLine(ok ? "YES" : "NO");
        }

        static Dictionary<int, List<int>> pathCache = new Dictionary<int, List<int>>();

        static List<int> GetPathFor(int node)
        {
            if (pathCache.ContainsKey(node))
            {
                return pathCache[node];
            }
            var path = new List<int>();
            do
            {
                path.Add(node);
                node = g[node].parent;
            }
            while (node != 0);

            path.Reverse();
            pathCache[node] = path;
            return path;
        }

        //static bool CloseEnough(List<int> deepPath, List<int> shortPath)
        //{
        //    return shortPath.Count == 1
        //        ? true
        //        : shortPath[shortPath.Count - 2] == deepPath[shortPath.Count - 2];
        //}

        static bool CloseEnough(List<int> deepPath, int node)
        {
            return node == 1 || g[node].parent == 1
                ? true
                : g[node].parent == deepPath[g[node].pathLength - 2];
        }

        static void Main(string[] args)
        {
            var (n, m) = ReadPairFromLine();
            ReadGraph(n);

            for (int i = 0; i < m; i++)
            {
                HandleQuery(ReadQueryFromLine());
            }

            //Console.WriteLine("END");
            //Console.ReadLine();
        }
    }
}


use io::stdin;
use std::{fmt::Debug, io, str::FromStr};

fn solve(heights: &Vec<usize>, parents: &Vec<[usize; 21]>, query: &mut [usize]) -> bool {
    if query.len() == 1 {
        return true;
    }

    query.sort_by(|&a, &b| heights[a].cmp(&heights[b]));
    let mut parent = 0;
    for node in query.iter() {
        let node_parent = parents[*node][0];
        if is_parent(node_parent, parent, heights, parents) {
            parent = node_parent;
        } else {
            return false;
        }
    }

    true
}

fn is_parent(
    mut node: usize,
    parent: usize,
    heights: &Vec<usize>,
    parents: &Vec<[usize; 21]>,
) -> bool {
    if heights[parent] > heights[node] {
        return false;
    }

    let mut index = 20;
    while heights[node] != heights[parent] {
        if (1 << index) <= heights[node] - heights[parent] {
            node = parents[node][index];
        } else {
            index -= 1;
        }
    }

    node == parent
}

fn dfs(
    graph: &Vec<Vec<usize>>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<[usize; 21]>
) {
    let mut queue: Vec<usize> = Vec::with_capacity(graph.len());
    queue.push(1);
    heights[1] = 1;
    parents[1][0] = 0;

    while let Some(node) = queue.pop() {
        for parent in 1..21 {
            parents[node][parent] = parents[parents[node][parent - 1]][parent - 1];
        }

        for &neighbour in graph[node].iter() {
            if parents[node][0] == neighbour {
                continue;
            }

            heights[neighbour] = heights[node] + 1;
            parents[neighbour][0] = node;
            queue.push(neighbour);
        }
    }
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![[0; 21]; n + 1];
    dfs(&graph, &mut heights, &mut parents);

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{fmt::Debug, io, str::FromStr};

fn solve(
    heights: &Vec<usize>,
    parents: &Vec<Vec<usize>>,
    query: &mut [usize],
) -> bool {
    query.sort_by(|&a, &b| heights[a].cmp(&heights[b]));
    let mut parent = 0;
    for node in query.iter() {
        let node_parent = parents[*node][0];
        if is_parent(node_parent, parent, heights, parents) {
            parent = node_parent;
        } else {
            return false;
        }
    }

    true
}

fn is_parent(mut node: usize, parent: usize, heights: &Vec<usize>, parents: &Vec<Vec<usize>>) -> bool {
    if heights[parent] > heights [node] {
        return false;
    }

    let mut index = 20;
    while heights[node] != heights[parent] {
        if (1 << index) <= heights[node] - heights[parent] {
            node = parents[node][index];
        } else {
            index -= 1;
        }
    }

    node == parent
}

fn dfs(
    top: usize,
    from: usize,
    graph: &Vec<Vec<usize>>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<Vec<usize>>,
    height: usize,
) {
    heights[top] = height;
    parents[top][0] = from;
    for parent in 1..21 {
        parents[top][parent] = parents[parents[top][parent - 1]][parent - 1];
    }

    for &neighbour in graph[top].iter() {
        if neighbour == from {
            continue;
        }

        dfs(neighbour, top, graph, heights, parents, height + 1);
    }
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![vec![0; 21]; n + 1];
    dfs(1, 0, &graph, &mut heights, &mut parents, 1);

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::{stdin, BufRead, StdinLock};
use std::{fmt::Debug, io, str::FromStr};

fn solve(
    heights: &Vec<usize>,
    parents: &Vec<usize>,
    tin: &Vec<usize>,
    tout: &Vec<usize>,
    query: &[usize],
) -> bool {
    let deepest = *query
        .iter()
        .max_by(|&&a, &&b| heights[a].cmp(&heights[b]))
        .unwrap();

    query
        .iter()
        .map(|&node| {
            if node != 1 && node != deepest {
                parents[node]
            } else {
                node
            }
        })
        .all(|node| is_parent(deepest, node, tin, tout))
}

fn is_parent(node: usize, parent: usize, tin: &Vec<usize>, tout: &Vec<usize>) -> bool {
    tin[parent] <= tin[node] && tout[node] <= tout[parent]
}

fn dfs(
    node: usize,
    from: usize,
    graph: &Vec<Vec<usize>>,
    tin: &mut Vec<usize>,
    tout: &mut Vec<usize>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<usize>,
    mut time: usize,
    depth: usize,
) -> usize {
    tin[node] = time;
    time += 1;

    heights[node] = depth;
    parents[node] = from;
    for &neighbour in graph[node].iter() {
        if neighbour != from {
            time = dfs(
                neighbour,
                node,
                graph,
                tin,
                tout,
                heights,
                parents,
                time,
                depth + 1,
            );
        }
    }

    tout[node] = time;
    time + 1
}

fn main() {
    let stdin = stdin();
    let ref mut stdin = stdin.lock();

    let input: Vec<usize> = read_arr(stdin);
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr(stdin);
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![0; n + 1];
    let mut tin = vec![0; n + 1];
    let mut tout = vec![0; n + 1];
    dfs(
        1,
        0,
        &graph,
        &mut tin,
        &mut tout,
        &mut heights,
        &mut parents,
        0,
        0,
    );

    let mut result_string = String::new();

    for _ in 1..=m {
        let input: Vec<usize> = read_arr(stdin);
        let result = solve(&heights, &parents, &tin, &tout, &input[1..]);

        if result {
            result_string.push_str("YES\n");
        } else {
            result_string.push_str("NO\n");
        }
    }

    println!("{}", result_string);
}

fn read_line(stdin: &mut StdinLock) -> String {
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>(stdin: &mut StdinLock) -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line(stdin).parse().expect("Num is given")
}

fn read_arr<T>(stdin: &mut StdinLock) -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line(stdin)
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{collections::{VecDeque, LinkedList}, fmt::Debug, io, str::FromStr};

fn solve(heights: &Vec<usize>, parents: &Vec<Vec<usize>>, query: &mut [usize]) -> bool {
    query.sort_by(|&a, &b| heights[a].cmp(&heights[b]));
    let mut parent = 0;
    for node in query.iter() {
        let node_parent = parents[*node][0];
        if is_parent(node_parent, parent, heights, parents) {
            parent = node_parent;
        } else {
            return false;
        }
    }

    true
}

fn is_parent(
    mut node: usize,
    parent: usize,
    heights: &Vec<usize>,
    parents: &Vec<Vec<usize>>,
) -> bool {
    if heights[parent] > heights[node] {
        return false;
    }

    let mut index = 20;
    while heights[node] != heights[parent] {
        if (1 << index) <= heights[node] - heights[parent] {
            node = parents[node][index];
        } else {
            index -= 1;
        }
    }

    node == parent
}

fn dfs(
    graph: &Vec<Vec<usize>>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<Vec<usize>>,
) {
    let mut queue: VecDeque<usize> = VecDeque::new();
    queue.push_back(1);
    heights[1] = 1;
    parents[1][0] = 0;

    while let Some(node) = queue.pop_front() {
        for parent in 1..21 {
            parents[node][parent] = parents[parents[node][parent - 1]][parent - 1];
        }

        for &neighbour in graph[node].iter() {
            if parents[node][0] == neighbour {
                continue;
            }

            heights[neighbour] = heights[node] + 1;
            parents[neighbour][0] = node;
            queue.push_back(neighbour);
        }
    }
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![vec![0; 21]; n + 1];
    dfs(&graph, &mut heights, &mut parents);

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{collections::{VecDeque, LinkedList}, fmt::Debug, io, str::FromStr};

fn solve(heights: &Vec<usize>, parents: &Vec<Vec<usize>>, query: &mut [usize]) -> bool {
    if query.len() == 1 {
        return true;
    }

    query.sort_by(|&a, &b| heights[a].cmp(&heights[b]));
    let mut parent = 0;
    for node in query.iter() {
        let node_parent = parents[*node][0];
        if is_parent(node_parent, parent, heights, parents) {
            parent = node_parent;
        } else {
            return false;
        }
    }

    true
}

fn is_parent(
    mut node: usize,
    parent: usize,
    heights: &Vec<usize>,
    parents: &Vec<Vec<usize>>,
) -> bool {
    if heights[parent] > heights[node] {
        return false;
    }

    let mut index = 20;
    while heights[node] != heights[parent] {
        if (1 << index) <= heights[node] - heights[parent] {
            node = parents[node][index];
        } else {
            index -= 1;
        }
    }

    node == parent
}

fn dfs(
    graph: &Vec<Vec<usize>>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<Vec<usize>>,
) {
    let mut queue: Vec<usize> = Vec::with_capacity(graph.len());
    queue.push(1);
    heights[1] = 1;
    parents[1][0] = 0;

    while let Some(node) = queue.pop() {
        for parent in 1..21 {
            parents[node][parent] = parents[parents[node][parent - 1]][parent - 1];
        }

        for &neighbour in graph[node].iter() {
            if parents[node][0] == neighbour {
                continue;
            }

            heights[neighbour] = heights[node] + 1;
            parents[neighbour][0] = node;
            queue.push(neighbour);
        }
    }
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![vec![0; 21]; n + 1];
    dfs(&graph, &mut heights, &mut parents);

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{collections::{VecDeque, LinkedList}, fmt::Debug, io, str::FromStr};

fn solve(heights: &Vec<usize>, parents: &Vec<Vec<usize>>, query: &mut [usize]) -> bool {
    query.sort_by(|&a, &b| heights[a].cmp(&heights[b]));
    let mut parent = 0;
    for node in query.iter() {
        let node_parent = parents[*node][0];
        if is_parent(node_parent, parent, heights, parents) {
            parent = node_parent;
        } else {
            return false;
        }
    }

    true
}

fn is_parent(
    mut node: usize,
    parent: usize,
    heights: &Vec<usize>,
    parents: &Vec<Vec<usize>>,
) -> bool {
    if heights[parent] > heights[node] {
        return false;
    }

    let mut index = 20;
    while heights[node] != heights[parent] {
        if (1 << index) <= heights[node] - heights[parent] {
            node = parents[node][index];
        } else {
            index -= 1;
        }
    }

    node == parent
}

fn dfs(
    graph: &Vec<Vec<usize>>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<Vec<usize>>,
) {
    let mut queue: Vec<usize> = Vec::with_capacity(graph.len());
    queue.push(1);
    heights[1] = 1;
    parents[1][0] = 0;

    while let Some(node) = queue.pop() {
        for parent in 1..21 {
            parents[node][parent] = parents[parents[node][parent - 1]][parent - 1];
        }

        for &neighbour in graph[node].iter() {
            if parents[node][0] == neighbour {
                continue;
            }

            heights[neighbour] = heights[node] + 1;
            parents[neighbour][0] = node;
            queue.push(neighbour);
        }
    }
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![vec![0; 21]; n + 1];
    dfs(&graph, &mut heights, &mut parents);

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{fmt::Debug, io, str::FromStr};

fn solve(
    heights: &Vec<usize>,
    parents: &Vec<Vec<usize>>,
    query: &mut [usize],
) -> bool {
    query.sort_by(|&a, &b| heights[a].cmp(&heights[b]));
    let mut parent = 0;
    for node in query.iter() {
        let node_parent = parents[*node][0];
        if is_parent(node_parent, parent, heights, parents) {
            parent = node_parent;
        } else {
            return false;
        }
    }

    true
}

fn is_parent(mut node: usize, parent: usize, heights: &Vec<usize>, parents: &Vec<Vec<usize>>) -> bool {
    if heights[parent] > heights [node] {
        return false;
    }

    let mut index = 29;
    while heights[node] != heights[parent] {
        if (1 << index) <= heights[node] - heights[parent] {
            node = parents[node][index];
        } else {
            index -= 1;
        }
    }

    node == parent
}

fn dfs(
    top: usize,
    from: usize,
    graph: &Vec<Vec<usize>>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<Vec<usize>>,
    height: usize,
) {
    heights[top] = height;
    parents[top][0] = from;
    for parent in 1..32 {
        parents[top][parent] = parents[parents[top][parent - 1]][parent - 1];
    }

    for &neighbour in graph[top].iter() {
        if neighbour == from {
            continue;
        }

        dfs(neighbour, top, graph, heights, parents, height + 1);
    }
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![vec![0; 32]; n + 1];
    dfs(1, 0, &graph, &mut heights, &mut parents, 1);

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{fmt::Debug, io, str::FromStr};

fn solve(
    heights: &Vec<usize>,
    parents: &Vec<usize>,
    tin: &Vec<usize>,
    tout: &Vec<usize>,
    query: &[usize],
) -> bool {
    let deepest = *query
        .iter()
        .max_by(|&&a, &&b| heights[a].cmp(&heights[b]))
        .unwrap();

    query
        .iter()
        .map(|&node| {
            if node != 1 && node != deepest {
                parents[node]
            } else {
                node
            }
        })
        .all(|node| is_parent(deepest, node, tin, tout))
}

fn is_parent(node: usize, parent: usize, tin: &Vec<usize>, tout: &Vec<usize>) -> bool {
    tin[parent] <= tin[node] && tout[node] <= tout[parent]
}

fn dfs(
    node: usize,
    from: usize,
    graph: &Vec<Vec<usize>>,
    tin: &mut Vec<usize>,
    tout: &mut Vec<usize>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<usize>,
    mut time: usize,
    depth: usize,
) -> usize {
    tin[node] = time;
    time += 1;

    heights[node] = depth;
    parents[node] = from;
    for &neighbour in graph[node].iter() {
        if neighbour != from {
            time = dfs(
                neighbour,
                node,
                graph,
                tin,
                tout,
                heights,
                parents,
                time,
                depth + 1,
            );
        }
    }

    tout[node] = time;
    time + 1
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![0; n + 1];
    let mut tin = vec![0; n + 1];
    let mut tout = vec![0; n + 1];
    dfs(
        1,
        0,
        &graph,
        &mut tin,
        &mut tout,
        &mut heights,
        &mut parents,
        0,
        0,
    );

    let mut result_string = String::new();

    for _ in 1..=m {
        let input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &tin, &tout, &input[1..]);

        if result {
            result_string.push_str("YES\n");
        } else {
            result_string.push_str("NO\n");
        }
    }

    println!("{}", result_string);
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


use io::stdin;
use std::{fmt::Debug, io, str::FromStr};

fn solve(
    heights: &Vec<usize>,
    parents: &Vec<usize>,
    tin: &Vec<usize>,
    tout: &Vec<usize>,
    query: &mut [usize],
) -> bool {
    let deepest = *query
        .iter()
        .max_by(|&&a, &&b| heights[a].cmp(&heights[b]))
        .unwrap();

    query
        .iter()
        .map(|&node| {
            if node != 1 && node != deepest {
                parents[node]
            } else {
                node
            }
        })
        .all(|node| is_parent(deepest, node, tin, tout))
}

fn is_parent(node: usize, parent: usize, tin: &Vec<usize>, tout: &Vec<usize>) -> bool {
    tin[parent] <= tin[node] && tout[node] <= tout[parent]
}

fn dfs(
    node: usize,
    from: usize,
    graph: &Vec<Vec<usize>>,
    tin: &mut Vec<usize>,
    tout: &mut Vec<usize>,
    heights: &mut Vec<usize>,
    parents: &mut Vec<usize>,
    mut time: usize,
    depth: usize,
) -> usize {
    tin[node] = time;
    time += 1;

    heights[node] = depth;
    parents[node] = from;
    for &neighbour in graph[node].iter() {
        if neighbour != from {
            time = dfs(
                neighbour,
                node,
                graph,
                tin,
                tout,
                heights,
                parents,
                time,
                depth + 1,
            );
        }
    }

    tout[node] = time;
    time + 1
}

fn main() {
    let input: Vec<usize> = read_arr();
    let (n, m) = (input[0], input[1]);

    let mut graph = vec![vec![]; n + 1];
    for _ in 1..n {
        let input: Vec<usize> = read_arr();
        graph[input[0]].push(input[1]);
        graph[input[1]].push(input[0]);
    }

    let mut heights = vec![0; n + 1];
    let mut parents = vec![0; n + 1];
    let mut tin = vec![0; n + 1];
    let mut tout = vec![0; n + 1];
    dfs(
        1,
        0,
        &graph,
        &mut tin,
        &mut tout,
        &mut heights,
        &mut parents,
        0,
        0,
    );

    for _ in 1..=m {
        let mut input: Vec<usize> = read_arr();
        let result = solve(&heights, &parents, &tin, &tout, &mut input[1..]);

        if result {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}

fn read_line() -> String {
    let stdin = stdin();
    let mut buffer = String::new();
    match stdin.read_line(&mut buffer) {
        Ok(_) => buffer.trim().to_owned(),
        Err(_) => panic!("Failed reading line"),
    }
}

fn read_num<T>() -> T
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line().parse().expect("Num is given")
}

fn read_arr<T>() -> Vec<T>
where
    T: Default + FromStr,
    <T as std::str::FromStr>::Err: Debug,
{
    read_line()
        .split_whitespace()
        .map(|x| x.parse().expect("Num is given"))
        .collect()
}


// ---------- begin Heavy-Light decomposition ----------
struct HLD {
    graph: Vec<Vec<usize>>,
    path_root: Vec<usize>,
    path_parent: Vec<usize>,
    left: Vec<usize>,
    right: Vec<usize>,
    parent: Vec<usize>,
}

impl HLD {
    fn new(n: usize) -> Self {
        HLD {
            graph: vec![vec![]; n],
            path_root: vec![],
            path_parent: vec![],
            left: vec![],
            right: vec![],
            parent: vec![],
        }
    }
    fn add_edge(&mut self, a: usize, b: usize) {
        self.graph[a].push(b);
        self.graph[b].push(a);
    }
    fn build(&mut self, root: usize) {
        let mut q = vec![];
        let mut stack = vec![(root, root)];
        self.parent.resize(self.graph.len(), root);
        let graph = &mut self.graph;
        while let Some((v, p)) = stack.pop() {
            q.push(v);
            self.parent[v] = p;
            for i in 0..graph[v].len() {
                if graph[v][i] == p {
                    graph[v].swap_remove(i);
                    break;
                }
            }
            for &u in &graph[v] {
                stack.push((u, v));
            }
        }
        let n = graph.len();
        let mut size = vec![1; n];
        for &v in q.iter().rev() {
            for i in 0..graph[v].len() {
                let u = graph[v][i];
                size[v] += size[u];
                if size[u] > size[graph[v][0]] {
                    graph[v].swap(0, i);
                }
            }
        }
        let mut path_root = vec![root; n];
        let mut path_parent = vec![root; n];
        let mut left = vec![0; n];
        let mut right = vec![0; n];
        let mut stack = vec![(root, 0)];
        let mut k = 0;
        while let Some((v, op)) = stack.pop() {
            if op == 1 {
                right[v] = k;
                continue;
            }
            left[v] = k;
            k += 1;
            stack.push((v, 1));
            for i in 1..graph[v].len() {
                let u = graph[v][i];
                path_root[u] = u;
                path_parent[u] = v;
                stack.push((u, 0));
            }
            if graph[v].len() > 0 {
                let u = graph[v][0];
                path_root[u] = path_root[v];
                path_parent[u] = path_parent[v];
                stack.push((u, 0));
            }
        }
        self.path_root = path_root;
        self.path_parent = path_parent;
        self.left = left;
        self.right = right;
    }
    fn sub_tree(&self, v: usize) -> (usize, usize) {
        (self.left[v], self.right[v])
    }
    fn path(&self, v: usize, u: usize) -> Vec<(usize, usize)> {
        let path = &self.path_root;
        let parent = &self.path_parent;
        let index = &self.left;
        let mut x = v;
        let mut y = u;
        let mut ans = vec![];
        while path[x] != path[y] {
            if index[x] < index[y] {
                let p = path[y];
                ans.push((index[p], index[y] + 1));
                y = parent[y];
            } else {
                let p = path[x];
                ans.push((index[p], index[x] + 1));
                x = parent[x];
            }
        }
        ans.push((std::cmp::min(index[x], index[y]), std::cmp::max(index[x], index[y]) + 1));
        ans
    }
    fn parent(&self, x: usize) -> usize {
        self.parent[x]
    }
}
// ---------- end Heavy-Light decomposition ----------
//---------- begin scanner ----------
#[allow(dead_code)]
mod scanner {
    use std::str::FromStr;
    use std::str::SplitWhitespace;
    use std::io::Read;
    use std;
    pub struct Scanner<'a> {
        it: SplitWhitespace<'a>
    }
    impl<'a> Scanner<'a> {
        pub fn new(s: &'a String) -> Scanner<'a> {
            Scanner {
                it: s.split_whitespace()
            }
        }
        pub fn next<T: FromStr>(&mut self) -> T {
            match self.it.next().unwrap().parse::<T>() {
                Ok(v) => v,
                _ => panic!("Scanner error")
            }
        }
        pub fn next_chars(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }
    }
    pub fn read_string() -> String {
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }
}
//---------- end scanner ----------

use std::io::Write;

fn main() {
    let sc = scanner::read_string();
    let mut sc = scanner::Scanner::new(&sc);
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    run(&mut sc, &mut out);
}

fn run(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter<std::io::StdoutLock>) {
    let n: usize = sc.next();
    let m: usize = sc.next();
    let mut hld = HLD::new(n);
    for _ in 1..n {
        let a: usize = sc.next();
        let b: usize = sc.next();
        hld.add_edge(a - 1, b - 1);
    }
    hld.build(0);
    let mut depth = vec![0; n];
    for i in 0..n {
        let path = hld.path(0, i);
        depth[i] = path.into_iter().fold(0, |s, a| s + a.1 - a.0);
    }
    for _ in 0..m {
        let k: usize = sc.next();
        let mut set = std::collections::BTreeSet::new();
        for _ in 0..k {
            let v: usize = sc.next();
            let u = hld.parent(v - 1);
            set.insert(u);
        }
        let mut p: Vec<(usize, usize)> = set.into_iter().map(|v| (depth[v], v)).collect();
        p.sort();
        let valid = p.windows(2).all(|a| {
            let (l, r) = hld.sub_tree(a[0].1);
            let (x, y) = hld.sub_tree(a[1].1);
            l <= x && y <= r
        });
        if valid {
            writeln!(out, "YES").ok();
        } else {
            writeln!(out, "NO").ok();
        }
    }
}


#![allow(unused)]

use kyoproio::*;
use std::{
    collections::*,
    io::{self, prelude::*},
    iter,
    mem::{replace, swap},
};

fn main() -> io::Result<()> {
    std::thread::Builder::new()
        .stack_size(50 * 1024 * 1024)
        .spawn(solve)?
        .join()
        .unwrap();
    Ok(())
}

fn solve() {
    let stdin = io::stdin();
    let mut kin = KInput::new(stdin.lock());
    let stdout = io::stdout();
    let mut out = io::BufWriter::new(stdout.lock());
    macro_rules! output {
        ($($args:expr),+) => { write!(&mut out, $($args),+) };
    }
    macro_rules! outputln {
        ($($args:expr),+) => { output!($($args),+); outputln!() };
        () => { output!("\n"); if cfg!(debug_assertions) { out.flush(); } }
    }

    let (n, q): (usize, usize) = kin.input();
    let mut g: Vec<_> = iter::repeat_with(Vec::new).take(n + 1).collect();
    for _ in 0..n - 1 {
        let (u, v): (usize, usize) = kin.input();
        g[u].push(v);
        g[v].push(u);
    }
    let mut par = vec![!0; n + 1];
    let mut depth = vec![0; n + 1];
    dfs(&g, 1, &mut par, &mut depth);
    let hld = Hld::new(&g, 1);
    for _ in 0..q {
        let ans = (|| {
            let k: usize = kin.input();
            let vs: Vec<usize> = kin.seq(k);
            let mut u = 1;
            for v in vs.iter().cloned() {
                if depth[v] > depth[u] {
                    u = v;
                }
            }
            for v in vs {
                let a = hld.lca(u, v);
                if v != 1 && a != v && a != par[v] {
                    return false;
                }
            }
            true
        })();
        outputln!("{}", ["NO", "YES"][ans as usize]);
    }
}

fn dfs(g: &[Vec<usize>], u: usize, par: &mut [usize], depth: &mut [usize]) {
    for &v in &g[u] {
        if v == par[u] {
            continue;
        }
        par[v] = u;
        depth[v] = depth[u] + 1;
        dfs(g, v, par, depth);
    }
}
#[derive(Debug)]
pub struct Hld {
    head: Vec<usize>,
    par: Vec<usize>,
    tab: Vec<usize>,
}
pub type Graph = [Vec<usize>];
impl Hld {
    pub fn new(g: &Graph, root: usize) -> Self {
        let mut heavy = vec![!0; g.len()];
        Self::dfs_heavy(g, &mut heavy, &mut vec![1; g.len()], root, !0);
        let mut hld = Hld {
            head: Vec::with_capacity(g.len()),
            par: Vec::with_capacity(g.len()),
            tab: vec![0; g.len()],
        };
        hld.dfs_build(g, &heavy, root, !0, root);
        hld
    }
    fn dfs_heavy(g: &Graph, heavy: &mut [usize], size: &mut [usize], u: usize, p: usize) {
        let mut max = 0;
        for v in g[u].iter().copied().filter(|&v| v != p) {
            Self::dfs_heavy(g, heavy, size, v, u);
            if size[v] > max {
                max = size[v];
                heavy[u] = v;
            }
            size[u] += size[v];
        }
    }
    fn dfs_build(&mut self, g: &Graph, heavy: &[usize], u: usize, p: usize, h: usize) {
        self.tab[u] = self.head.len();
        self.head.push(h);
        self.par.push(p);
        if heavy[u] == !0 {
            return;
        }
        self.dfs_build(g, heavy, heavy[u], u, h);
        for v in g[u].iter().copied().filter(|&v| v != p && v != heavy[u]) {
            self.dfs_build(g, heavy, v, u, v);
        }
    }
    pub fn lca(&self, mut u: usize, mut v: usize) -> usize {
        loop {
            if self.tab[u] > self.tab[v] {
                swap(&mut u, &mut v);
            }
            if self.head[self.tab[u]] == self.head[self.tab[v]] {
                return u;
            }
            v = self.par[self.tab[self.head[self.tab[v]]]];
        }
    }
}
// -----------------------------------------------------------------------------
pub mod kyoproio {
    #![warn(unused)]

    pub use std::io::prelude::*;

    pub trait Input: Sized {
        fn str(&mut self) -> &str;
        fn bytes(&mut self) -> &[u8] {
            self.str().as_ref()
        }
        fn input<T: InputParse>(&mut self) -> T {
            self.input_fallible().expect("input error")
        }
        fn input_fallible<T: InputParse>(&mut self) -> Result<T> {
            T::input(self)
        }
        fn iter<T: InputParse>(&mut self) -> Iter<T, Self> {
            Iter {
                input: self,
                _t: std::marker::PhantomData,
            }
        }
        fn seq<T: InputParse, B: std::iter::FromIterator<T>>(&mut self, n: usize) -> B {
            self.iter().take(n).collect()
        }
    }
    pub struct KInput<R> {
        src: R,
        buf: String,
        pos: usize,
    }
    impl<R: BufRead> KInput<R> {
        pub fn new(src: R) -> Self {
            KInput {
                src,
                buf: String::with_capacity(1024),
                pos: 0,
            }
        }
    }
    impl<R: BufRead> Input for KInput<R> {
        fn str(&mut self) -> &str {
            loop {
                if self.pos >= self.buf.len() {
                    self.buf.clear();
                    let len = self.src.read_line(&mut self.buf).expect("io error");
                    self.pos = 0;
                    if len == 0 {
                        return &self.buf;
                    }
                }
                let range = self.pos
                    ..self.buf[self.pos..]
                        .find(|c: char| c.is_ascii_whitespace())
                        .map(|i| i + self.pos)
                        .unwrap_or_else(|| self.buf.len());
                self.pos = range.end + 1;
                if range.end - range.start > 0 {
                    return &self.buf[range];
                }
            }
        }
    }
    pub struct Iter<'a, T, I> {
        input: &'a mut I,
        _t: std::marker::PhantomData<T>,
    }
    impl<'a, T: InputParse, I: Input> Iterator for Iter<'a, T, I> {
        type Item = T;
        fn next(&mut self) -> Option<Self::Item> {
            Some(self.input.input())
        }
    }
    type Result<T> = std::result::Result<T, Box<dyn std::error::Error + 'static>>;
    pub trait InputParse: Sized {
        fn input<I: Input>(input: &mut I) -> Result<Self>;
    }
    macro_rules! input_from_str_impls {
        { $($T:ty)* } => {
            $(impl InputParse for $T {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    input.str().parse::<$T>().map_err(|e| e.into())
                }
            })*
        };
    }
    input_from_str_impls! {
        String char bool f32 f64
        isize i8 i16 i32 i64 i128
        usize u8 u16 u32 u64 u128
    }
    macro_rules! input_tuple_impls {
        { $(($($T:ident),+))* } => {
            $(impl<$($T: InputParse),+> InputParse for ($($T),+) {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    Ok(($($T::input(input)?),+))
                }
            })*
        };
    }
    input_tuple_impls! {
        (A, B)
        (A, B, C)
        (A, B, C, D)
        (A, B, C, D, E)
        (A, B, C, D, E, F)
        (A, B, C, D, E, F, G)
    }
    /*
    macro_rules! input_array_impls {
       { $($N:expr)* } => {
            $(impl<T: InputParse> InputParse for [T; $N] {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    use std::{ mem::MaybeUninit, ptr };
                    let mut a = MaybeUninit::<[T; $N]>::uninit();
                    unsafe {
                        for i in 0..$N {
                            match T::input(input) {
                                Ok(v) => ptr::write(&mut (*a.as_mut_ptr())[i], v),
                                Err(e) => {
                                    ptr::drop_in_place(&mut (*a.as_mut_ptr())[..i]);
                                    return Err(e);
                                }
                            }
                        }
                        Ok(a.assume_init())
                    }
                }
            })*
        };
    }
    input_array_impls! {
        1 2 3 4 5 6 7 8
    }
    */
}


#![allow(unused)]

use kyoproio::*;
use std::{
    collections::*,
    io::{self, prelude::*},
    iter,
    mem::{replace, swap},
};

fn main() -> io::Result<()> {
    std::thread::Builder::new()
        .stack_size(50 * 1024 * 1024)
        .spawn(solve)?
        .join()
        .unwrap();
    Ok(())
}

fn solve() {
    let stdin = io::stdin();
    let mut kin = KInput::new(stdin.lock());
    let stdout = io::stdout();
    let mut out = io::BufWriter::new(stdout.lock());
    macro_rules! output {
        ($($args:expr),+) => { write!(&mut out, $($args),+) };
    }
    macro_rules! outputln {
        ($($args:expr),+) => { output!($($args),+); outputln!() };
        () => { output!("\n"); if cfg!(debug_assertions) { out.flush(); } }
    }

    let (n, q): (usize, usize) = kin.input();
    let mut g: Vec<_> = iter::repeat_with(Vec::new).take(n + 1).collect();
    for _ in 0..n - 1 {
        let (u, v): (usize, usize) = kin.input();
        g[u].push(v);
        g[v].push(u);
    }
    let mut par = vec![!0; n + 1];
    let mut depth = vec![0; n + 1];
    dfs(&g, 1, &mut par, &mut depth);
    let hld = Hld::new(&g, 1);
    for _ in 0..q {
        let ans = (|| {
            let k: usize = kin.input();
            let vs: Vec<usize> = kin.seq(k);
            let mut u = 1;
            for v in vs.iter().cloned() {
                if depth[v] > depth[u] {
                    u = v;
                }
            }
            for v in vs {
                let a = hld.lca(u, v);
                if v != 1 && a != v && a != par[v] {
                    return false;
                }
            }
            true
        })();
        outputln!("{}", ["NO", "YES"][ans as usize]);
    }
}

fn dfs(g: &[Vec<usize>], u: usize, par: &mut [usize], depth: &mut [usize]) {
    for &v in &g[u] {
        if v == par[u] {
            continue;
        }
        par[v] = u;
        depth[v] = depth[u] + 1;
        dfs(g, v, par, depth);
    }
}
#[derive(Debug)]
pub struct Hld {
    head: Vec<usize>,
    par: Vec<usize>,
    tab: Vec<usize>,
}
pub type Graph = [Vec<usize>];
impl Hld {
    pub fn new(g: &Graph, root: usize) -> Self {
        let mut heavy = vec![!0; g.len()];
        Self::dfs_heavy(g, &mut heavy, &mut vec![1; g.len()], root, !0);
        let mut hld = Hld {
            head: Vec::with_capacity(g.len()),
            par: Vec::with_capacity(g.len()),
            tab: vec![0; g.len()],
        };
        hld.dfs_build(g, &heavy, root, !0, root);
        hld
    }
    fn dfs_heavy(g: &Graph, heavy: &mut [usize], size: &mut [usize], u: usize, p: usize) {
        let mut max = 0;
        for v in g[u].iter().cloned().filter(|&v| v != p) {
            Self::dfs_heavy(g, heavy, size, v, u);
            if size[v] > max {
                max = size[v];
                heavy[u] = v;
            }
            size[u] += size[v];
        }
    }
    fn dfs_build(&mut self, g: &Graph, heavy: &[usize], u: usize, p: usize, h: usize) {
        self.tab[u] = self.head.len();
        self.head.push(h);
        self.par.push(p);
        if heavy[u] == !0 {
            return;
        }
        self.dfs_build(g, heavy, heavy[u], u, h);
        for v in g[u].iter().cloned().filter(|&v| v != p && v != heavy[u]) {
            self.dfs_build(g, heavy, v, u, v);
        }
    }
    pub fn lca(&self, mut u: usize, mut v: usize) -> usize {
        loop {
            if self.tab[u] > self.tab[v] {
                swap(&mut u, &mut v);
            }
            if self.head[self.tab[u]] == self.head[self.tab[v]] {
                return u;
            }
            v = self.par[self.tab[self.head[self.tab[v]]]];
        }
    }
}
// -----------------------------------------------------------------------------
pub mod kyoproio {
    #![warn(unused)]

    pub use std::io::prelude::*;

    pub trait Input: Sized {
        fn str(&mut self) -> &str;
        fn bytes(&mut self) -> &[u8] {
            self.str().as_ref()
        }
        fn input<T: InputParse>(&mut self) -> T {
            self.input_fallible().expect("input error")
        }
        fn input_fallible<T: InputParse>(&mut self) -> Result<T> {
            T::input(self)
        }
        fn iter<T: InputParse>(&mut self) -> Iter<T, Self> {
            Iter {
                input: self,
                _t: std::marker::PhantomData,
            }
        }
        fn seq<T: InputParse, B: std::iter::FromIterator<T>>(&mut self, n: usize) -> B {
            self.iter().take(n).collect()
        }
    }
    pub struct KInput<R> {
        src: R,
        buf: String,
        pos: usize,
    }
    impl<R: BufRead> KInput<R> {
        pub fn new(src: R) -> Self {
            KInput {
                src,
                buf: String::with_capacity(1024),
                pos: 0,
            }
        }
    }
    impl<R: BufRead> Input for KInput<R> {
        fn str(&mut self) -> &str {
            loop {
                if self.pos >= self.buf.len() {
                    self.buf.clear();
                    let len = self.src.read_line(&mut self.buf).expect("io error");
                    self.pos = 0;
                    if len == 0 {
                        return &self.buf;
                    }
                }
                let range = self.pos
                    ..self.buf[self.pos..]
                        .find(|c: char| c.is_ascii_whitespace())
                        .map(|i| i + self.pos)
                        .unwrap_or_else(|| self.buf.len());
                self.pos = range.end + 1;
                if range.end - range.start > 0 {
                    return &self.buf[range];
                }
            }
        }
    }
    pub struct Iter<'a, T, I> {
        input: &'a mut I,
        _t: std::marker::PhantomData<T>,
    }
    impl<'a, T: InputParse, I: Input> Iterator for Iter<'a, T, I> {
        type Item = T;
        fn next(&mut self) -> Option<Self::Item> {
            Some(self.input.input())
        }
    }
    type Result<T> = std::result::Result<T, Box<dyn std::error::Error + 'static>>;
    pub trait InputParse: Sized {
        fn input<I: Input>(input: &mut I) -> Result<Self>;
    }
    macro_rules! input_from_str_impls {
        { $($T:ty)* } => {
            $(impl InputParse for $T {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    input.str().parse::<$T>().map_err(|e| e.into())
                }
            })*
        };
    }
    input_from_str_impls! {
        String char bool f32 f64
        isize i8 i16 i32 i64 i128
        usize u8 u16 u32 u64 u128
    }
    macro_rules! input_tuple_impls {
        { $(($($T:ident),+))* } => {
            $(impl<$($T: InputParse),+> InputParse for ($($T),+) {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    Ok(($($T::input(input)?),+))
                }
            })*
        };
    }
    input_tuple_impls! {
        (A, B)
        (A, B, C)
        (A, B, C, D)
        (A, B, C, D, E)
        (A, B, C, D, E, F)
        (A, B, C, D, E, F, G)
    }
    /*
    macro_rules! input_array_impls {
       { $($N:expr)* } => {
            $(impl<T: InputParse> InputParse for [T; $N] {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    use std::{ mem::MaybeUninit, ptr };
                    let mut a = MaybeUninit::<[T; $N]>::uninit();
                    unsafe {
                        for i in 0..$N {
                            match T::input(input) {
                                Ok(v) => ptr::write(&mut (*a.as_mut_ptr())[i], v),
                                Err(e) => {
                                    ptr::drop_in_place(&mut (*a.as_mut_ptr())[..i]);
                                    return Err(e);
                                }
                            }
                        }
                        Ok(a.assume_init())
                    }
                }
            })*
        };
    }
    input_array_impls! {
        1 2 3 4 5 6 7 8
    }
    */
}


#![allow(unused)]

use kyoproio::*;
use std::{
    collections::*,
    io::{self, prelude::*},
    iter,
    mem::{replace, swap},
};

fn main() -> io::Result<()> {
    std::thread::Builder::new()
        .stack_size(50 * 1024 * 1024)
        .spawn(solve)?
        .join()
        .unwrap();
    Ok(())
}

fn solve() {
    let stdin = io::stdin();
    let mut kin = KInput::new(stdin.lock());
    let stdout = io::stdout();
    let mut out = io::BufWriter::new(stdout.lock());
    macro_rules! output {
        ($($args:expr),+) => { write!(&mut out, $($args),+) };
    }
    macro_rules! outputln {
        ($($args:expr),+) => { output!($($args),+); outputln!() };
        () => { output!("\n"); if cfg!(debug_assertions) { out.flush(); } }
    }

    let (n, q): (usize, usize) = kin.input();
    let mut g: Vec<_> = iter::repeat_with(Vec::new).take(n + 1).collect();
    for _ in 0..n - 1 {
        let (u, v): (usize, usize) = kin.input();
        g[u].push(v);
        g[v].push(u);
    }
    let mut par = vec![!0; n + 1];
    let mut depth = vec![0; n + 1];
    dfs(&g, 1, &mut par, &mut depth);
    for _ in 0..q {
        let ans = (|| {
            let k: usize = kin.input();
            let vs: Vec<usize> = kin.seq(k);
            let mut set = BTreeSet::new();
            let mut u = 1;
            for v in vs.iter().cloned() {
                if depth[v] > depth[u] {
                    u = v;
                }
            }
            while u != !0 {
                set.insert(u);
                u = par[u];
            }
            for v in vs {
                if v != 1 && !set.contains(&par[v]) {
                    return false;
                }
            }
            true
        })();
        outputln!("{}", ["NO", "YES"][ans as usize]);
    }
}

fn dfs(g: &[Vec<usize>], u: usize, par: &mut [usize], depth: &mut [usize]) {
    for &v in &g[u] {
        if v == par[u] {
            continue;
        }
        par[v] = u;
        depth[v] = depth[u] + 1;
        dfs(g, v, par, depth);
    }
}

// -----------------------------------------------------------------------------
pub mod kyoproio {
    #![warn(unused)]

    pub use std::io::prelude::*;

    pub trait Input: Sized {
        fn str(&mut self) -> &str;
        fn bytes(&mut self) -> &[u8] {
            self.str().as_ref()
        }
        fn input<T: InputParse>(&mut self) -> T {
            self.input_fallible().expect("input error")
        }
        fn input_fallible<T: InputParse>(&mut self) -> Result<T> {
            T::input(self)
        }
        fn iter<T: InputParse>(&mut self) -> Iter<T, Self> {
            Iter {
                input: self,
                _t: std::marker::PhantomData,
            }
        }
        fn seq<T: InputParse, B: std::iter::FromIterator<T>>(&mut self, n: usize) -> B {
            self.iter().take(n).collect()
        }
    }
    pub struct KInput<R> {
        src: R,
        buf: String,
        pos: usize,
    }
    impl<R: BufRead> KInput<R> {
        pub fn new(src: R) -> Self {
            KInput {
                src,
                buf: String::with_capacity(1024),
                pos: 0,
            }
        }
    }
    impl<R: BufRead> Input for KInput<R> {
        fn str(&mut self) -> &str {
            loop {
                if self.pos >= self.buf.len() {
                    self.buf.clear();
                    let len = self.src.read_line(&mut self.buf).expect("io error");
                    self.pos = 0;
                    if len == 0 {
                        return &self.buf;
                    }
                }
                let range = self.pos
                    ..self.buf[self.pos..]
                        .find(|c: char| c.is_ascii_whitespace())
                        .map(|i| i + self.pos)
                        .unwrap_or_else(|| self.buf.len());
                self.pos = range.end + 1;
                if range.end - range.start > 0 {
                    return &self.buf[range];
                }
            }
        }
    }
    pub struct Iter<'a, T, I> {
        input: &'a mut I,
        _t: std::marker::PhantomData<T>,
    }
    impl<'a, T: InputParse, I: Input> Iterator for Iter<'a, T, I> {
        type Item = T;
        fn next(&mut self) -> Option<Self::Item> {
            Some(self.input.input())
        }
    }
    type Result<T> = std::result::Result<T, Box<dyn std::error::Error + 'static>>;
    pub trait InputParse: Sized {
        fn input<I: Input>(input: &mut I) -> Result<Self>;
    }
    macro_rules! input_from_str_impls {
        { $($T:ty)* } => {
            $(impl InputParse for $T {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    input.str().parse::<$T>().map_err(|e| e.into())
                }
            })*
        };
    }
    input_from_str_impls! {
        String char bool f32 f64
        isize i8 i16 i32 i64 i128
        usize u8 u16 u32 u64 u128
    }
    macro_rules! input_tuple_impls {
        { $(($($T:ident),+))* } => {
            $(impl<$($T: InputParse),+> InputParse for ($($T),+) {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    Ok(($($T::input(input)?),+))
                }
            })*
        };
    }
    input_tuple_impls! {
        (A, B)
        (A, B, C)
        (A, B, C, D)
        (A, B, C, D, E)
        (A, B, C, D, E, F)
        (A, B, C, D, E, F, G)
    }
    /*
    macro_rules! input_array_impls {
       { $($N:expr)* } => {
            $(impl<T: InputParse> InputParse for [T; $N] {
                fn input<I: Input>(input: &mut I) -> Result<Self> {
                    use std::{ mem::MaybeUninit, ptr };
                    let mut a = MaybeUninit::<[T; $N]>::uninit();
                    unsafe {
                        for i in 0..$N {
                            match T::input(input) {
                                Ok(v) => ptr::write(&mut (*a.as_mut_ptr())[i], v),
                                Err(e) => {
                                    ptr::drop_in_place(&mut (*a.as_mut_ptr())[..i]);
                                    return Err(e);
                                }
                            }
                        }
                        Ok(a.assume_init())
                    }
                }
            })*
        };
    }
    input_array_impls! {
        1 2 3 4 5 6 7 8
    }
    */
}


#[doc = " https://github.com/akiradeveloper/rust-comp-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[macro_export]
macro_rules ! chmax { ( $ x : expr , $ ( $ v : expr ) ,+ ) => { $ ( $ x = std :: cmp :: max ( $ x ,$ v ) ; ) + } ; }
#[macro_export]
macro_rules ! chmin { ( $ x : expr , $ ( $ v : expr ) ,+ ) => { $ ( $ x = std :: cmp :: min ( $ x ,$ v ) ; ) + } ; }
#[macro_export]
macro_rules ! max { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ xs : expr ) ,+ ) => { std :: cmp :: max ( $ x , max ! ( $ ( $ xs ) ,+ ) ) } ; }
#[macro_export]
macro_rules ! min { ( $ x : expr ) => ( $ x ) ; ( $ x : expr , $ ( $ xs : expr ) ,+ ) => { std :: cmp :: min ( $ x , min ! ( $ ( $ xs ) ,+ ) ) } ; }
#[macro_export]
macro_rules ! dvec { ( $ t : expr ; $ len : expr ) => { vec ! [ $ t ; $ len ] } ; ( $ t : expr ; $ len : expr , $ ( $ rest : expr ) ,* ) => { vec ! [ dvec ! ( $ t ; $ ( $ rest ) ,* ) ; $ len ] } ; }
#[macro_export]
macro_rules ! cfor { ( ; $ ( $ rest : tt ) * ) => { cfor ! ( ( ) ; $ ( $ rest ) * ) } ; ( $ ( $ init : stmt ) ,+; ; $ ( $ rest : tt ) * ) => { cfor ! ( $ ( $ init ) ,+; ! false ; $ ( $ rest ) * ) } ; ( $ ( $ init : stmt ) ,+; $ cond : expr ; ; $ body : block ) => { cfor ! { $ ( $ init ) ,+; $ cond ; ( ) ; $ body } } ; ( $ ( $ init : stmt ) ,+; $ cond : expr ; $ ( $ step : expr ) ,+; $ body : block ) => { { $ ( $ init ; ) + while $ cond { let mut _first = true ; let mut _continue = false ; loop { if ! _first { _continue = true ; break } _first = false ; $ body } if ! _continue { break } $ ( $ step ; ) + } } } ; }
#[doc = " main"]
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[macro_export]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut parser = Parser :: from_str ( $ s ) ; input_inner ! { parser , $ ( $ r ) * } } ; ( parser = $ parser : ident , $ ( $ r : tt ) * ) => { input_inner ! { $ parser , $ ( $ r ) * } } ; ( new_stdin_parser = $ parser : ident , $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let reader = std :: io :: BufReader :: new ( stdin . lock ( ) ) ; let mut $ parser = Parser :: new ( reader ) ; input_inner ! { $ parser , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { input ! { new_stdin_parser = parser , $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! input_inner { ( $ parser : ident ) => { } ; ( $ parser : ident , ) => { } ; ( $ parser : ident , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ parser , $ t ) ; input_inner ! { $ parser $ ( $ r ) * } } ; }
#[macro_export]
macro_rules ! read_value { ( $ parser : ident , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ parser , $ t ) ) ,* ) } ; ( $ parser : ident , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ parser , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ parser : ident , chars ) => { read_value ! ( $ parser , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ parser : ident , usize1 ) => { read_value ! ( $ parser , usize ) - 1 } ; ( $ parser : ident , $ t : ty ) => { $ parser . next ::<$ t > ( ) . expect ( "Parse error" ) } ; }
use std::io;
use std::io::BufRead;
use std::str;
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}
impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}
impl<R: BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len, complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                if len == 0 {
                    break;
                }
                (len, buf2[len - 1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T: str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return str::from_utf8(&self.buf[begin..end]).unwrap().parse::<T>();
            } else {
                self.update_buf();
            }
        }
    }
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    input!{
        new_stdin_parser = parser,
        n: usize, m: usize,
        e: [(usize,usize);n-1],
    }

    let mut g = HLDecomposition::new(n);
    for (u,v) in e {
        let u = u-1;
        let v = v-1;
        g.connect(u,v);
    }
    g.build(0);

    for _ in 0..m {
        input!{
            parser = parser,
            k: usize,
            v: [usize;k],
        }
        let mut xs = vec![];
        for i in 0..k {
            let x = v[i]-1;
            if x != 0 && g.par[x].unwrap() != 0 {
                let up = g.par[x].unwrap();
                let depth = g.depth[up] as i64;
                xs.push((depth, up));
            } else {
                let depth = g.depth[x] as i64;
                // xs.push((depth, x));
            }
        }
        xs.sort();
        let mut y = vec![];
        for x in xs {
            y.push(x.1);
        }
        // dbg!(&y);
        let m = y.len();
        let top = y[0];
        let mut ok = true;
        for i in 0..m {
            let u = y[i];
            let lca = g.lca(top, u);
            if lca != top {
                ok = false;
            }
        }
        writeln!(out,"{}",if ok {"YES"} else {"NO"});
    }
}
struct HLDecomposition {
    n: usize,
    g: Vec<Vec<usize>>,
    subcnt: Vec<usize>,
    depth: Vec<usize>,
    pub par: Vec<Option<usize>>,
    heavy_next: Vec<Option<usize>>,
    heavy_head: Vec<usize>,
    real_to_virt: Vec<usize>,
    pub virt_to_real: Vec<usize>,
}
impl HLDecomposition {
    pub fn new(n: usize) -> Self {
        HLDecomposition {
            n: n,
            g: vec![vec![]; n],
            subcnt: vec![0; n],
            depth: vec![0; n],
            par: vec![None; n],
            heavy_next: vec![None; n],
            heavy_head: vec![n; n],
            real_to_virt: vec![n; n],
            virt_to_real: vec![n; n],
        }
    }
    pub fn connect(&mut self, u: usize, v: usize) {
        self.g[u].push(v);
        self.g[v].push(u);
    }
    #[doc = "O(N)"]
    pub fn build(&mut self, root: usize) {
        self.dfs1(root);
        self.dfs2(root);
        self.bfs(root);
    }
    fn dfs1(&mut self, root: usize) {
        self.depth[root] = 0;
        self.par[root] = None;
        self.dfs1_sub(root, None);
    }
    fn dfs1_sub(&mut self, u: usize, par: Option<usize>) -> usize {
        let mut cnt = 1;
        for v in self.g[u].clone() {
            if Some(v) == par {
                continue;
            }
            self.depth[v] = self.depth[u] + 1;
            self.par[v] = Some(u);
            cnt += self.dfs1_sub(v, Some(u));
        }
        self.subcnt[u] = cnt;
        cnt
    }
    fn dfs2(&mut self, root: usize) {
        self.dfs2_sub(root, None);
    }
    fn dfs2_sub(&mut self, u: usize, par: Option<usize>) {
        let mut maxv = 0;
        let mut heavy_next = None;
        let cld = self.g[u].clone();
        for &v in &cld {
            if Some(v) == par {
                continue;
            }
            if self.subcnt[v] > maxv {
                maxv = self.subcnt[v];
                heavy_next = Some(v);
            }
        }
        if let Some(hn) = heavy_next {
            self.heavy_next[u] = Some(hn);
            self.dfs2_sub(hn, Some(u));
        }
        for &v in &cld {
            if Some(v) == par || Some(v) == heavy_next {
                continue;
            }
            self.dfs2_sub(v, Some(u));
        }
    }
    fn bfs(&mut self, root: usize) {
        let mut cur_virt_id = 0;
        let mut q = VecDeque::new();
        q.push_back(root);
        while let Some(h) = q.pop_front() {
            let mut cur0 = Some(h);
            while cur0.is_some() {
                let cur = cur0.unwrap();
                self.real_to_virt[cur] = cur_virt_id;
                self.virt_to_real[cur_virt_id] = cur;
                cur_virt_id += 1;
                self.heavy_head[cur] = h;
                for v in self.g[cur].clone() {
                    if Some(v) == self.par[cur] || Some(v) == self.heavy_next[cur] {
                        continue;
                    }
                    q.push_back(v);
                }
                cur0 = self.heavy_next[cur];
            }
        }
    }
    #[doc = "O(log N)"]
    pub fn lca(&self, u: usize, v: usize) -> usize {
        let mut l = u;
        let mut r = v;
        loop {
            if self.real_to_virt[l] > self.real_to_virt[r] {
                std::mem::swap(&mut l, &mut r);
            }
            if self.heavy_head[l] == self.heavy_head[r] {
                return l;
            }
            r = self.par[self.heavy_head[r]].unwrap();
        }
    }
    #[doc = "returns a list of [l,r]. O(N)"]
    pub fn vertex_decomposition(&self) -> Vec<(usize, usize)> {
        let mut vhead = vec![self.n; self.n];
        for i in 0..self.n {
            vhead[i] = self.real_to_virt[self.heavy_head[i]];
        }
        let mut hs = std::collections::HashMap::new();
        for x in vhead {
            *hs.entry(x).or_insert(0) += 1;
        }
        let mut res = vec![];
        for (k, v) in hs {
            res.push((k, k + v - 1));
        }
        res
    }
    #[doc = "return a list of [l,r]. edge is represented by the child with larger virtual id. O(N)"]
    pub fn edge_decomposition(&self) -> Vec<(usize, usize)> {
        let V = self.vertex_decomposition();
        let mut res = vec![];
        for (u, v) in V {
            let u = if u == 0 { 1 } else { u };
            res.push((u, v));
        }
        res
    }
    #[doc = "O(logN)"]
    pub fn vertex_decomposition_between(&self, u: usize, v: usize) -> Vec<(usize, usize)> {
        let mut res = vec![];
        let mut l = u;
        let mut r = v;
        loop {
            if self.real_to_virt[l] > self.real_to_virt[r] {
                std::mem::swap(&mut l, &mut r);
            }
            let p = (
                std::cmp::max(self.real_to_virt[self.heavy_head[r]], self.real_to_virt[l]),
                self.real_to_virt[r],
            );
            res.push(p);
            if self.heavy_head[l] != self.heavy_head[r] {
                r = self.par[self.heavy_head[r]].unwrap();
            } else {
                break;
            }
        }
        res
    }
    #[doc = "O(logN)"]
    pub fn edge_decomposition_between(&self, u: usize, v: usize) -> Vec<(usize, usize)> {
        let mut res = vec![];
        let mut l = u;
        let mut r = v;
        loop {
            if self.real_to_virt[l] > self.real_to_virt[r] {
                std::mem::swap(&mut l, &mut r);
            }
            if self.heavy_head[l] != self.heavy_head[r] {
                let p = (self.real_to_virt[self.heavy_head[r]], self.real_to_virt[r]);
                res.push(p);
                r = self.par[self.heavy_head[r]].unwrap();
            } else {
                if l != r {
                    let p = (self.real_to_virt[l] + 1, self.real_to_virt[r]);
                    res.push(p);
                }
                break;
            }
        }
        res
    }
    pub fn distance(&self, u: usize, v: usize) -> usize {
        self.depth[u] + self.depth[v] - 2 * self.depth[self.lca(u, v)]
    }
}