CF369E Valera and Queries

Description

Valera loves segments. He has recently come up with one interesting problem. The $ Ox $ axis of coordinates has $ n $ segments, the $ i $ -th segment starts in position $ l_{i} $ and ends in position $ r_{i} $ (we will mark it as $ [l_{i},r_{i}] $ ). Your task is to process $ m $ queries, each consists of number $ cnt_{i} $ and a set of $ cnt_{i} $ coordinates of points located on the $ Ox $ axis. The answer to the query is the number of segments, such that each of them contains at least one point from the query. Segment $ [l,r] $ contains point $ q $ , if $ l

Input Format

The first line contains two integers $ n $ , $ m $ ( $ 1

Output Format

Print $ m $ non-negative integers, where the $ i $ -th number is the response to the $ i $ -th query.