So you decided to hold a contest on Codeforces. You prepared the problems: statements, solutions, checkers, validators, tests... Suddenly, your coordinator asks you to change all your tests to multiple testcases in the easiest problem!

Initially, each test in that problem is just an array. The maximum size of an array is $k$. For simplicity, the contents of arrays don't matter. You have $n$ tests — the $i$-th test is an array of size $m_i$ ($1 \le m_i \le k$).

Your coordinator asks you to distribute all of your arrays into multiple testcases. Each testcase can include multiple arrays. However, each testcase should include no more than $c_1$ arrays of size greater than or equal to $1$ ($\ge 1$), no more than $c_2$ arrays of size greater than or equal to $2$, $\dots$, no more than $c_k$ arrays of size greater than or equal to $k$. Also, $c_1 \ge c_2 \ge \dots \ge c_k$.

So now your goal is to create the new testcases in such a way that:   each of the initial arrays appears in exactly one testcase;  for each testcase the given conditions hold;  the number of testcases is minimum possible. 

Print the minimum possible number of testcases you can achieve and the sizes of arrays included in each testcase.


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le n, k \le 2 \cdot 10^5$) — the number of initial tests and the limit for the size of each array.

The second line contains $n$ integers $m_1, m_2, \dots, m_n$ ($1 \le m_i \le k$) — the sizes of the arrays in the original tests.

The third line contains $k$ integers $c_1, c_2, \dots, c_k$ ($n \ge c_1 \ge c_2 \ge \dots \ge c_k \ge 1$); $c_i$ is the maximum number of arrays of size greater than or equal to $i$ you can have in a single testcase.


-----Output-----

In the first line print a single integer $ans$ ($1 \le ans \le n$) — the minimum number of testcases you can achieve.

Each of the next $ans$ lines should contain the description of a testcase in the following format:

$t$ $a_1$ $a_2$ $\dots$ $a_{t}$ ($1 \le t\le n$) — the testcase includes $t$ arrays, $a_i$ is the size of the $i$-th array in that testcase.

Each of the initial arrays should appear in exactly one testcase. In particular, it implies that the sum of $t$ over all $ans$ testcases should be equal to $n$.

Note that the answer always exists due to $c_k \ge 1$ (and therefore $c_1 \ge 1$).

If there are multiple answers, you can output any one of them.


-----Examples-----
Input
4 3
1 2 2 3
4 1 1

Output
3
1 2
2 1 3
1 2

Input
6 10
5 8 1 10 8 7
6 6 4 4 3 2 2 2 1 1

Output
2
3 8 5 7
3 10 8 1

Input
5 1
1 1 1 1 1
5

Output
1
5 1 1 1 1 1

Input
5 1
1 1 1 1 1
1

Output
5
1 1
1 1
1 1
1 1
1 1



-----Note-----

In the first example there is no way to distribute the tests into less than $3$ testcases. The given answer satisfies the conditions: each of the testcases includes no more than $4$ arrays of size greater than or equal to $1$ and no more than $1$ array of sizes greater than or equal to $2$ and $3$.

Note that there are multiple valid answers for this test. For example, testcases with sizes $[[2], [1, 2], [3]]$ would also be correct.

However, testcases with sizes $[[1, 2], [2, 3]]$ would be incorrect because there are $2$ arrays of size greater than or equal to $2$ in the second testcase.

Note the difference between the third and the fourth examples. You can include up to $5$ arrays of size greater than or equal to $1$ in the third example, so you can put all arrays into a single testcase. And you can have only up to $1$ array in the fourth example. Thus, every array should be included in a separate testcase.

Difficulty: MEDIUM

Starter code:

Solutions:
import collections
import time
import os
import sys
import bisect
import heapq
from typing import List
(N, K) = map(int, input().split())
A = [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
A.sort()
greater = [0 for _ in range(K + 1)]
for v in A:
	greater[min(v, K)] += 1
for i in range(K - 1, 0, -1):
	greater[i] += greater[i + 1]
m = max([greater[i] // C[i] if greater[i] % C[i] == 0 else greater[i] // C[i] + 1 for i in range(1, K + 1)])
ans = [[] for _ in range(m)]
for (i, v) in enumerate(A):
	ans[i % m].append(v)
print(m)
for v in ans:
	print('{} {}'.format(len(v), ' '.join(map(str, v))))


import sys
readline = sys.stdin.readline
(N, K) = map(int, readline().split())
A = list(map(int, readline().split()))
C = [None] + list(map(int, readline().split()))
table = [0] * (K + 1)
for a in A:
	table[a] += 1
for i in range(K - 1, -1, -1):
	table[i] += table[i + 1]
ok = N
ng = 0
while abs(ok - ng) > 1:
	med = (ok + ng) // 2
	if all((-(-table[k] // med) <= C[k] for k in range(1, K + 1))):
		ok = med
	else:
		ng = med
A.sort(reverse=True)
Ans = [[] for _ in range(ok)]
for i in range(N):
	Ans[i % ok].append(A[i])
sys.stdout.write('{}\n'.format(ok))
for i in range(ok):
	sys.stdout.write('{} '.format(len(Ans[i])))
	sys.stdout.write('{}\n'.format(' '.join(map(str, Ans[i]))))


from math import gcd

def rn():
	a = int(input())
	return a

def rl():
	a = list(map(int, input().split()))
	return a
for _ in range(1):
	[n, k] = rl()
	m = rl()
	c = rl()
	d = [0 for _ in range(k + 1)]
	for i in m:
		d[i] += 1
	vac = 0
	curr = 0
	cl = 0
	for i in range(k, 0, -1):
		new = c[i - 1] - curr
		curr += new
		vac += new * cl
		vac -= d[i]
		if vac < 0:
			cl -= vac // curr
			vac -= curr * (vac // curr)
	print(cl)
	ans = [[] for _ in range(cl)]
	put = -1
	for i in range(1, k + 1):
		for j in range(d[i]):
			put = (put + 1) % cl
			ans[put].append(i)
	for i in ans:
		print(len(i), *i)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
li = list(map(int, input().split()))
mi = []
l.sort()
mi.append(li[0])
for i in range(1, k):
	mi.append(min(mi[-1], li[i]))

def check(mid):
	a = [[] for i in range(mid)]
	t = 0
	for i in range(n):
		a[t % mid].append(l[i])
		t += 1
	for i in range(mid):
		c = 1
		for j in range(len(a[i]) - 1, -1, -1):
			if mi[a[i][j] - 1] >= c:
				c += 1
			else:
				return False
	return True
st = 1
end = n
while st <= end:
	mid = (st + end) // 2
	if check(mid) == True:
		ans = mid
		end = mid - 1
	else:
		st = mid + 1
print(ans)
mid = ans
a = [[] for i in range(mid)]
t = 0
for i in range(n):
	a[t % mid].append(l[i])
	t += 1
for i in range(mid):
	print(len(a[i]), *a[i])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import factorial, ceil
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	(n, k) = RL()
	arrm = RLL()
	arrc = [0] + RLL()
	rec = [0] * (k + 1)
	for i in arrm:
		rec[i] += 1
	s = rec.copy()
	for i in range(k - 1, -1, -1):
		s[i] += s[i + 1]
	resn = 0
	for i in range(1, k + 1):
		now = s[i]
		if now == 0:
			continue
		num = ceil(now / arrc[i])
		resn = max(resn, num)
	res = [[] for _ in range(resn)]
	ind = 0
	for i in range(k, 0, -1):
		now = rec[i]
		for _ in range(now):
			res[ind % resn].append(i)
			ind += 1
	print(resn)
	for i in res:
		print(len(i), *i)
main()


import heapq
line = input()
(n, k) = (int(i) for i in line.split(' '))
line = input()
num = [int(i) for i in line.split(' ')]
line = input()
c = [int(i) for i in line.split(' ')]
memo = [(c[-1], 999999999)]
pre = c[-1]
for i in range(k - 2, -1, -1):
	if c[i] == pre:
		continue
	memo.append((c[i] - pre, i + 2))
	pre = c[i]
num.sort(reverse=True)
(heap, res) = ([], [])
for i in num:
	if not heap or memo[heap[0][0]][1] <= i:
		heapq.heappush(heap, [0, 0, len(res)])
		res.append([])
	heap[0][1] += 1
	res[heap[0][2]].append(i)
	if heap[0][1] == memo[heap[0][0]][0]:
		x = heapq.heappop(heap)
		x[0] += 1
		x[1] = 0
		if x[0] != len(memo):
			heapq.heappush(heap, x)
print(len(res))
for i in res:
	print(len(i), end=' ')
	for j in i:
		print(j, end=' ')
	print()


from sys import stdin, stdout
import heapq as hq
from collections import defaultdict
import math
t = 1
for tc in range(t):
	(n, k) = list(map(int, stdin.readline().split()))
	sizes = list(map(int, stdin.readline().split()))
	limits = list(map(int, stdin.readline().split()))
	num = [0 for x in range(k)]
	count = defaultdict(int)
	for size in sizes:
		count[size] += 1
	csum = 0
	for key in sorted(count.keys())[::-1]:
		cur = key + 1
		while cur - 1 < len(num) and num[cur - 1] == 0:
			num[cur - 1] = csum
			cur += 1
		csum += count[key]
		num[key - 1] = csum
	cur = 0
	while cur < len(num) and num[cur] == 0:
		num[cur] = csum
		cur += 1
	maxfrac = 0
	for (top, denom) in zip(num, limits):
		frac = math.ceil(top / denom)
		if frac > maxfrac:
			maxfrac = frac
	result = defaultdict(list)
	i = 0
	for key in sorted(count.keys())[::-1]:
		number = count[key]
		while number > 0:
			result[i].append(key)
			number -= 1
			i += 1
			i %= maxfrac
	stdout.write(str(maxfrac) + '\n')
	for i in range(maxfrac):
		res = len(result[i])
		stdout.write(str(res) + ' ')
		for val in result[i]:
			stdout.write(str(val) + ' ')
		stdout.write('\n')


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
num = [0] * (k + 1)
for i in m:
	num[i] += 1
for i in range(k - 1, -1, -1):
	num[i] += num[i + 1]
num = num[1:]
maxi = 0
for i in range(k):
	maxi = max((num[i] - 1) // c[i] + 1, maxi)
ans = [[] for i in range(maxi)]
m.sort(reverse=True)
for i in range(len(m)):
	ans[i % maxi].append(m[i])
print(len(ans))
for i in range(maxi):
	print(' '.join(map(str, [len(ans[i])] + ans[i])))


import os
import sys
from io import BytesIO, IOBase

class LinkedListNode:

	def __init__(self, List, capacity):
		self.values = List
		self.next = None
		self.prev = None
		self.capacity = capacity

class LinkedList:

	def __init__(self):
		self.end = None
		self.output = list()

	def add(self, node):
		if self.end is None:
			self.end = node
		else:
			self.end.next = node
			node.prev = self.end
			self.end = node

	def delete(self, temp):
		try:
			if len(temp.next.values) == 0:
				temp.next = temp.next.next
				if temp.next is None:
					self.end = temp
				else:
					temp.next.prev = temp
		except AttributeError:
			if len(temp.values) == 0:
				self.end = None

	def traverse(self):
		temp = self.end
		m = 0
		day = list()
		while temp is not None:
			self.delete(temp)
			cap = temp.capacity - m
			c = min(cap, len(temp.values))
			m += c
			for i in range(c):
				day.append(temp.values.pop())
			temp = temp.prev
		self.output.append(day)

def main():
	(n, k) = map(int, input().split())
	M = list(map(int, input().split()))
	C = list(map(int, input().split()))
	brackets = [1 for i in range(k + 1)]
	c = 2
	for i in range(1, k):
		if C[i] == C[i - 1]:
			brackets[i + 1] = brackets[i]
		else:
			brackets[i + 1] = c
			c += 1
	M.sort()
	count = dict()
	for m in M:
		count[m] = count.get(m, 0) + 1
	bracketsCount = brackets[k]
	data = [list() for i in range(bracketsCount)]
	sizes = [0] * bracketsCount
	for i in range(1, k + 1):
		pos = brackets[i] - 1
		try:
			for _ in range(count[i]):
				data[pos].append(i)
		except KeyError:
			pass
	for i in range(1, k + 1):
		pos = brackets[i] - 1
		sizes[pos] = C[i - 1]
	linkedList = LinkedList()
	for i in range(len(data)):
		if len(data[i]) != 0:
			linkedList.add(LinkedListNode(data[i], sizes[i]))
	while linkedList.end is not None:
		linkedList.traverse()
	answer = linkedList.output
	print(len(answer) - 1)
	for a in answer:
		l = len(a)
		if l > 0:
			print(l, end=' ')
			for a1 in a:
				print(a1, end=' ')
			print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = lambda s: self.buffer.write(s.encode()) if self.writable else None

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline().decode('ascii')

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(10000)
main()


from collections import deque

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	c = [0] + list(map(int, input().split()))
	tests = [[]]
	a.sort(reverse=True)
	for x in a:
		if len(tests[-1]) >= c[x]:
			tests.append([x])
		else:
			ok = len(tests)
			ng = -1
			while ok - ng > 1:
				mid = (ok + ng) // 2
				if len(tests[mid]) < c[x]:
					ok = mid
				else:
					ng = mid
			tests[ok].append(x)
	print(len(tests))
	for x in tests:
		print(len(x), *x)
	return
main()


import sys
import math

class IoTool:
	DEBUG = 0

	def _reader_dbg():
		with open('./input.txt', 'r') as f:
			lines = f.readlines()
		for l in lines:
			yield l.strip()

	def _reader_oj():
		return iter(sys.stdin.read().split('\n'))
	reader = _reader_dbg() if DEBUG else _reader_oj()

	def read():
		return next(IoTool.reader)
input = IoTool.read

def main():
	(n, k) = map(int, input().split())
	arrs = list(map(int, input().split()))
	cons = [3 * 10 ** 5] + list(map(int, input().split()))
	arrs.sort()
	cnt = [0] * (k + 1)
	for v in arrs:
		cnt[v] += 1
	for idx in range(k - 1, -1, -1):
		cnt[idx] += cnt[idx + 1]
	ans = max([math.ceil(i / j) for (i, j) in zip(cnt, cons)])
	out = [[] for _ in range(ans)]
	for (idx, v) in enumerate(arrs):
		out[idx % ans].append(v)
	print(ans)
	for arr in out:
		print(len(arr), end=' ')
		for v in arr:
			print(v, end=' ')
		print('')
main()


def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys, io, os
	import heapq
	from collections import defaultdict as dd, deque
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
	out = sys.stdout.write
	INF = int(1000000000.0)
	(n, k) = [int(x) for x in input().split()]
	M = [int(x) for x in input().split()]
	C = [int(x) for x in input().split()]
	M.sort()
	d1 = [0] * n
	d2 = [0] * n
	ans = []
	n1 = n - 1
	m = INF
	while n1 >= 0:
		s = bl(d1, C[M[n1] - 1]) - 1
		d2[n1] = s
		d1[s] += 1
		m = min(m, s)
		n1 -= 1
	ans = [[] for i in range(n - m)]
	for i in range(n):
		ans[n - 1 - d2[i]].append(str(M[i]))
	for i in range(len(ans)):
		ans[i] = str(len(ans[i])) + ' ' + ' '.join(ans[i])
	out(str(len(ans)) + '\n')
	out('\n'.join(ans))
main()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = int(1000000000.0) + 7

def power(k, n):
	if n == 0:
		return 1
	if n % 2:
		return power(k, n - 1) * k % mod
	t = power(k, n // 2)
	return t * t % mod

def totalPrimeFactors(n):
	count = 0
	if n % 2 == 0:
		count += 1
		while n % 2 == 0:
			n //= 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			count += 1
			while n % i == 0:
				n //= i
		i += 2
	if n > 2:
		count += 1
	return count

def main():
	(n, k) = map(int, input().split())
	m = list(map(int, input().split()))
	c = list(map(int, input().split()))
	karr = [0 for i in range(k + 1)]
	for i in m:
		karr[i] += 1
	l = 1
	r = n
	ans = n
	while l <= r:
		mid = (l + r) // 2
		poss = 1
		used = 0
		for j in range(k, 0, -1):
			if mid * c[j - 1] - used < karr[j]:
				poss = 0
				break
			used += karr[j]
		if poss:
			r = mid - 1
			ans = min(ans, mid)
		else:
			l = mid + 1
	print(ans)
	fans = [[] for i in range(ans)]
	m.sort()
	for i in range(len(m)):
		fans[i % len(fans)].append(m[i])
	for i in fans:
		print(len(i), *i)
	return
main()


import sys
import math
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
cnt = [0] * (k + 1)
cnt[1] = len(a)
idx = 0
for i in range(1, k + 1):
	num_i = 0
	while True:
		if idx == n:
			break
		if a[idx] == i:
			num_i += 1
			idx += 1
		else:
			cnt[i + 1] = cnt[i] - num_i
			break
size = 0
for i in range(k):
	size = max(size, -(cnt[i + 1] // -b[i]))
print(size)
size_idx = 0
ans = [[] for _ in range(size)]
for i in range(size):
	if i < n % size:
		ans[i].append(n // size + 1)
	else:
		ans[i].append(n // size)
for i in a:
	ans[size_idx % size].append(i)
	size_idx += 1
for i in range(size):
	for j in range(len(ans[i])):
		print(ans[i][j], end=' ')
	print()


import math
(N, K) = [int(i) for i in input().split()]
M = sorted([int(i) for i in input().split()], reverse=True)
C = [int(i) for i in input().split()]
G = []
i = len(M) - 1
answer = 0
for k in range(K):
	while i >= 0 and M[i] < k + 1:
		i -= 1
	G.append(i + 1)
	answer = max(answer, math.ceil(G[k] / C[k]))
test_cases = [[] for k in range(answer)]
for (j, m) in enumerate(M):
	test_cases[j % answer].append(m)
print(answer)
for test_case in test_cases:
	print(len(test_case), ' '.join([str(e) for e in test_case]))


import math

def check2(case):
	for i in case:
		for j in range(len(i)):
			if len(i) - j > c[i[j] - 1]:
				return False
	return True

def check(test):
	if math.ceil(n // test) > c[0]:
		return [False]
	cases = [[] for i in range(test)]
	for i in range(n):
		cases[i % test].append(m[i])
	if check2(cases):
		return [True, cases]
	else:
		return [False]
(n, k) = map(int, input().split())
m = sorted(list(map(int, input().split())))
c = list(map(int, input().split()))
low = 1
high = n + 1
while low < high:
	mid = (low + high) // 2
	if check(mid)[0]:
		high = mid - 1
	else:
		low = mid + 1
if check(low)[0]:
	ans = low
else:
	ans = low + 1
arr = check(ans)[1]
print(ans)
for i in arr:
	print(len(i), end=' ')
	print(*i)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
(m, c, ans) = (sorted([int(i) for i in input().split()], reverse=True), [int(i) for i in input().split()], 0)
for i in range(n):
	ans = max(ans, (i + c[m[i] - 1]) // c[m[i] - 1])
cases = [[] for i in range(ans)]
for i in range(n):
	cases[i % ans].append(m[i])
print(ans)
for i in range(ans):
	print(len(cases[i]), *cases[i])


import sys
input = sys.stdin.readline
from bisect import *

def judge(x):
	return cnt[x] + 1 <= c[mi]

def binary_search():
	(l, r) = (0, size - 1)
	while l <= r:
		mid = (l + r) // 2
		if judge(mid):
			r = mid - 1
		else:
			l = mid + 1
	return l
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = [-1] + list(map(int, input().split()))
m.sort()
size = 0
for i in range(1, k + 1):
	size = max(size, (n - bisect_left(m, i) + c[i] - 1) // c[i])
ans = [[] for _ in range(size)]
cnt = [0] * size
m.reverse()
now = 0
for mi in m:
	i = binary_search()
	ans[i].append(mi)
	cnt[i] += 1
print(size)
for ans_i in ans:
	print(len(ans_i), *ans_i)


(n, k) = [int(x) for x in input().split()]
M = [int(x) - 1 for x in input().split()]
C = [int(x) for x in input().split()]
M.sort()
ans = []
for i in reversed(range(n)):
	if i == n - 1 or C[M[i]] != C[M[i + 1]]:
		ii = 0
	while True:
		if ii == len(ans):
			ans.append([])
		elif len(ans[ii]) == C[M[i]]:
			ii += 1
		else:
			ans[ii].append(M[i])
			break
out = []
out.append(len(ans))
for a in ans:
	out.append(len(a))
	for x in a:
		out.append(x + 1)
print('\n'.join((str(x) for x in out)))


MOD = 10 ** 9 + 7

def main():
	for _ in inputt(1):
		(n, k) = inputi()
		(M, C) = inputl(2)
		M = sorted(M)
		mc = Counter(M)
		mck = sorted(mc, reverse=True)
		ma = 0
		t = 0
		for k in mck:
			t += mc[k]
			ma = max(ma, ceil(t / C[k - 1]))
		print(ma)
		for i in range(ma):
			m = M[i:n:ma]
			print(len(m), *m)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	print('debug', *args, **kwargs)
	sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda : map(int, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		pass
sieve = Sieve()

def isprime(n):
	pass

def prime(n):
	pass

def factorint(n):
	factordict = defaultdict(int)
	for i in sieve:
		if n <= i * i:
			break
		while not n % i:
			factordict[i] += 1
			n //= i
	if n != 1:
		factordict[n] += 1
	return factordict
main()


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys, io, os
	import heapq
	from collections import defaultdict as dd, deque
	data = input

	def mdata():
		return list(map(int, data().split()))
	out = sys.stdout.write
	INF = int(1000000000.0)
	(n, k) = mdata()
	M = mdata()
	C = mdata()
	M.sort()
	d1 = [0] * n
	d2 = [0] * n
	ans = []
	n1 = n - 1
	m = INF
	while n1 >= 0:
		s = bl(d1, C[M[n1] - 1]) - 1
		d2[n1] = s
		d1[s] += 1
		m = min(m, s)
		n1 -= 1
	ans = [[] for i in range(n - m)]
	for i in range(n):
		ans[n - 1 - d2[i]].append(str(M[i]))
	for i in range(len(ans)):
		ans[i] = str(len(ans[i])) + ' ' + ' '.join(ans[i])
	print(str(len(ans)))
	print('\n'.join(ans))
main()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in input().rstrip()]
(n, k) = li()
m = sorted(li(), reverse=1)
l = [0] + li()
ans = [[] for i in range(n)]
d = []
heappush(d, [1, 0])
ans[0].append(m[0])
(index, i) = (1, 1)
for i in range(1, n):
	curr = m[i]
	lim = l[curr]
	(a, b) = heappop(d)
	heappush(d, [a, b])
	if lim > a:
		heappop(d)
		heappush(d, [a + 1, b])
		ans[b].append(curr)
	else:
		heappush(d, [1, index])
		ans[index].append(curr)
		index += 1
print(len(d))
for i in range(len(ans)):
	if len(ans[i]):
		print(len(ans[i]), end=' ')
		print(*ans[i], sep=' ')
	else:
		break


import sys
from math import ceil
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a

def calc(t):
	for i in range(1, k + 1):
		if ceil(g[i] / t) > c[i]:
			return False
	return True
(n, k) = I()
g = [0] * (k + 1)
ms = I()
for i in range(n):
	g[ms[i]] += 1
cs = g[:]
for i in reversed(range(1, k)):
	g[i] += g[i + 1]
c = I()
c = [0] + c
l = 1
r = n
ans = n
while l <= r:
	mid = l + (r - l) // 2
	if calc(mid):
		r = mid - 1
		ans = min(ans, mid)
	else:
		l = mid + 1
ms.sort()
print(ans)
test = [[] for i in range(ans)]
for i in range(len(ms)):
	test[i % ans].append(ms[i])
for i in test:
	print(len(i), *i)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
f = [0] * (k + 1)
for i in m:
	f[i] += 1
c = list(map(int, input().split()))
(cur, ans) = (0, 0)
for i in range(k - 1, -1, -1):
	cur += f[i + 1]
	ans = max(ans, (cur + c[i] - 1) // c[i])
a = []
for i in range(ans):
	b = []
	a.append(b)
idx = 0
for i in range(k, 0, -1):
	for j in range(f[i]):
		a[idx].append(i)
		idx += 1
		idx = idx % ans
print(ans)
for i in range(ans):
	print(len(a[i]), end=' ')
	print(*a[i])


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, K, M, C):
	testcases = []
	lens = []
	M.sort(reverse=True)
	for x in M:
		allowed = C[x - 1]
		if False:
			for (i, tc) in enumerate(testcases):
				if len(tc) < allowed:
					tc.append(x)
					lens[i] += 1
					break
			else:
				testcases.append([x])
				lens.append(1)
			assert all((x == len(y) for (x, y) in zip(lens, testcases)))
		else:
			lo = 0
			hi = len(lens) - 1
			if not lens or lens[hi] >= allowed:
				testcases.append([x])
				lens.append(1)
			else:
				if lens[lo] >= allowed:
					assert lens[hi] < allowed
					while hi - lo > 1:
						mid = (lo + hi) // 2
						if lens[mid] < allowed:
							hi = mid
						else:
							lo = mid
						assert lens[lo] >= allowed
						assert lens[hi] < allowed
				else:
					hi = lo
				testcases[hi].append(x)
				lens[hi] += 1
	return str(len(testcases)) + '\n' + '\n'.join((str(len(ans)) + ' ' + ' '.join(map(str, ans)) for ans in testcases))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N, K) = [int(x) for x in input().split()]
M = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
ans = solve(N, K, M, C)
print(ans)


import math
l = input().split()
n = int(l[0])
k = int(l[1])
l = input().split()
li = [int(i) for i in l]
c = input().split()
ck = [int(i) for i in c]
arrfreq = [0 for i in range(k)]
for i in li:
	arrfreq[i - 1] += 1
maxa = 0
sumi = 0
ans = k - 1
for i in range(k):
	sumi += arrfreq[k - 1 - i]
	if math.ceil(sumi / ck[k - 1 - i]) >= maxa:
		maxa = math.ceil(sumi / ck[k - 1 - i])
		ans = k - i - 1
arrfi = [[] for i in range(maxa)]
curr = 0
for i in range(k):
	num = i + 1
	for j in range(arrfreq[i]):
		arrfi[curr].append(num)
		curr += 1
		if curr == maxa:
			curr = 0
print(maxa)
for i in range(maxa):
	print(len(arrfi[i]), end=' ')
	for j in arrfi[i]:
		print(j, end=' ')
	print()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=10 ** 10, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(200001)]
pp = []

def SieveOfEratosthenes(n=200000):
	p = 2
	c = 0
	while p * p <= n:
		if prime[p] == True:
			c += 1
			pp.append(p)
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = 0
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = mid + 1
			left = mid + 1
	return res
import sys
input = lambda : sys.stdin.readline().strip()
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort(reverse=True)
g = 0
ans = 0
for i in range(k, 0, -1):
	while g < n and m[g] == i:
		g += 1
	ans = max(ans, (g + c[i - 1] - 1) // c[i - 1])
res = [[] for _ in range(ans)]
for i in range(n):
	res[i % ans].append(m[i])
print(ans)
for i in res:
	print(len(i), end=' ')
	print(' '.join(map(str, i)))


import sys
import math
input = sys.stdin.buffer.readline
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort()
out = []
pointer = []
minI = -1
maxI = -1
for i in range(n - 1, -1, -1):
	mm = m[i]
	if len(out) == 0:
		out.append([mm])
		pointer.append(0)
		minI = 0
		maxI = 0
		continue
	if c[mm - 1] - len(out[minI]) > 0:
		out[minI].append(mm)
		if len(out[minI]) > len(out[pointer[minI]]):
			tmp = pointer[minI]
			pointer[maxI] = minI
			pointer[minI] = minI
			maxI = minI
			minI = tmp
	else:
		out.append([mm])
		pointer.append(minI)
		minI = len(out) - 1
print(len(out))
for i in range(len(out)):
	print(len(out[i]), end=' ')
	for j in out[i]:
		print(j, end=' ')
	print()


(n, k) = map(int, input().split())
ms = list(map(int, input().split()))
ks = list(map(int, input().split()))
import math
ms.sort(reverse=True)
sol = 1
for i in range(len(ms)):
	sol = max(sol, int(math.ceil((i + 1) / ks[ms[i] - 1])))
aa = [[] for i in range(sol)]
for i in range(len(ms)):
	aa[i % sol].append(ms[i])
print(sol)
for i in range(sol):
	print(' '.join(map(str, [len(aa[i])] + aa[i])))


from heapq import heapify, heappush, heappop
(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
arr.sort(reverse=True)
testcase = []
heappush(testcase, [1, 0])
ans = [[arr[0]]]
ans_len = 1
for i in range(1, n):
	(size, index) = heappop(testcase)
	if size + 1 <= c[arr[i] - 1]:
		ans[index].append(arr[i])
		size += 1
		heappush(testcase, [size, index])
	else:
		heappush(testcase, [size, index])
		ans.append([arr[i]])
		ans_len += 1
		heappush(testcase, [1, ans_len - 1])
print(len(ans))
for test in ans:
	print(len(test), end=' ')
	print(*test)


import math
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort()
ans = 0
for i in range(n - 1, -1, -1):
	sw = min(m[i] - 1, k - 1)
	ans = max(ans, math.ceil((n - i) / c[sw]))
res = [[] for _ in range(ans)]
for i in range(n):
	res[i % ans].append(m[i])
print(ans)
for i in range(ans):
	print(len(res[i]), *res[i])


from collections import defaultdict
from bisect import bisect_right, bisect_left
from collections import deque
import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
ar = [int(x) for x in input().split()]
fr = [int(x) for x in input().split()]
d = defaultdict(list)
count = deque()
count.append(0)
ct = 1
ar.sort(reverse=True)
for i in ar:
	val = bisect_left(count, fr[i - 1])
	if val - 1 < 0:
		ct += 1
		count.appendleft(1)
		d[ct].append(i)
	else:
		count[val - 1] += 1
		d[ct - val + 1].append(i)
print(ct)
for i in range(1, ct + 1):
	print(len(d[i]), end=' ')
	for j in d[i]:
		print(j, end=' ')
	print()


import bisect
import sys
input = sys.stdin.readline

def update(inp, add, ar, n):
	while inp < n:
		ar[inp] += add
		inp += inp & -inp

def summation(inp, ar):
	ans = 0
	while inp:
		ans += ar[inp]
		inp -= inp & -inp
	return ans

def binary(l, r, active):
	while True:
		if l == r:
			return l
		elif r == l + 1:
			if summation(l, active):
				return l
			else:
				return r
		else:
			mid = (l + r) // 2
			if summation(mid, active):
				r = mid
			else:
				l = mid + 1
(n, k) = map(int, input().split())
mr = list(map(int, input().split()))
mr.sort(reverse=True)
cr = list(map(int, input().split()))
revcr = cr[::-1]
array = []
size = []
for i in range(n):
	array.append([])
	size.append(0)
indexofarray = [[]]
active = [0]
for i in range(k):
	indexofarray.append([])
	active.append(0)
ans = 0
for i in range(n):
	el = mr[i]
	if summation(k - el + 1, active) == 0:
		update(1, 1, active, k + 1)
		indexofarray[1].append(ans)
		ans += 1
	xx = binary(1, k - el + 1, active)
	indAra = indexofarray[xx][-1]
	array[indAra].append(el)
	size[indAra] += 1
	if cr[el - 1] == size[indAra]:
		update(xx, -1, active, k + 1)
		indexofarray[xx].pop()
		new = bisect.bisect_left(revcr, size[indAra] + 1)
		if new == k:
			continue
		indexofarray[new + 1].append(indAra)
		update(new + 1, 1, active, k + 1)
print(ans)
for i in range(ans):
	print(len(array[i]), *array[i])


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
mi = []
for i in range(n):
	mi.append([m[i], i])
mi.sort()
mi.reverse()
ans = [[]]
for loop in range(n):
	(now, ind) = mi[loop]
	l = -1
	r = len(ans)
	while r - l != 1:
		mid = (l + r) // 2
		if len(ans[mid]) < c[now - 1]:
			r = mid
		else:
			l = mid
	if r == len(ans):
		ans.append([now])
	else:
		ans[r].append(now)
print(len(ans))
for i in ans:
	print(len(i), *i)


import sys
from collections import defaultdict
from bisect import bisect_left
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
(n, k) = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
C = list(map(int, input().split()))
ANS = [[] for i in range(n)]
SIZE = [0] * n
for a in A:
	require = C[a - 1]
	x = bisect_left(SIZE, -require + 1)
	SIZE[x] -= 1
	ANS[x].append(a)
print(bisect_left(SIZE, 0))
for ans in ANS:
	if len(ans) == 0:
		break
	print(len(ans), end=' ')
	print(*ans)


(n, k) = map(int, input().split())
mmm = list(map(int, input().split()))
ccc = [0] + list(map(int, input().split()))
mmm.sort(reverse=True)
ans = [[]]
for m in mmm:
	ai = 0
	c = ccc[m]
	if c <= len(ans[-1]):
		ans.append([m])
		continue
	l = -1
	r = len(ans) - 1
	while l + 1 < r:
		k = (l + r) // 2
		if c > len(ans[k]):
			r = k
		else:
			l = k
	ans[r].append(m)
print(len(ans))
for ls in ans:
	print(len(ls), end=' ')
	print(' '.join(map(str, ls)))


import sys
from typing import List
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s

def invr():
	return map(int, input().split())

def from_file(f):
	return f.readline

def solve(n, K, m: List[int], c: List[int]) -> List[List[int]]:
	min_required = 0
	m.sort()
	index = 0
	while index < len(m):
		count_ge = len(m) - index
		limit = c[m[index] - 1]
		need = count_ge // limit
		if count_ge % limit != 0:
			need += 1
		min_required = max(min_required, need)
		while index + 1 < len(m) and m[index + 1] == m[index]:
			index += 1
		index += 1
	res = [[] for _ in range(min_required)]
	for (i, l) in enumerate(m):
		res[i % min_required].append(l)
	return res
(n, k) = invr()
m = inlt()
c = inlt()
res = solve(n, k, m, c)
print(len(res))
for arr in res:
	print(f"{len(arr)} {' '.join(map(str, arr))}")


(n, k) = map(int, input().split())
m = sorted(list(map(int, input().split())), reverse=True)
c = list(map(int, input().split()))
ans = [[m[0]]]
l = 1
now = 0
for i in range(1, n):
	if len(ans[0]) < c[m[i] - 1]:
		now = 0
		ans[now].append(m[i])
	else:
		while now != l:
			if len(ans[now]) < c[m[i] - 1]:
				break
			now += 1
		if now == l:
			ans.append([m[i]])
			l += 1
		else:
			ans[now].append(m[i])
print(len(ans))
for i in range(len(ans)):
	print(len(ans[i]), end=' ')
	print(' '.join(map(str, ans[i])))


from sys import stdin, stdout
from math import *
input = stdin.readline
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
for i in range(1, k):
	if c[i] > c[i - 1]:
		c[i] = c[i - 1]
m.sort()
h = [0] * k
for i in range(n):
	h[m[i] - 1] += 1
for i in range(k - 2, -1, -1):
	h[i] += h[i + 1]
ans = 0
for i in range(k):
	ans = max(ceil(h[i] / c[i]), ans)
rslt = [[] for i in range(ans)]
for i in range(n):
	rslt[i % ans].append(m[i])
print(ans)
for i in range(ans):
	print(len(rslt[i]), *rslt[i])


from bisect import bisect_left as bl, bisect_right as br
(N, K) = list(map(int, input().split()))
M = sorted([int(a) for a in input().split()])[::-1]
C = [0] + [int(a) for a in input().split()]
ANS = [{}]
S = [0]
for m in M:
	a = br(S, -C[m])
	if a >= len(ANS):
		ANS.append({})
		S.append(0)
	if m not in ANS[a]:
		ANS[a][m] = 1
	else:
		ANS[a][m] += 1
	S[a] -= 1
print(len(ANS))
for ans in ANS:
	L = []
	for a in ans:
		L += [a] * ans[a]
	print(len(L), *L)


(n, k) = map(int, input().split())
m = sorted(list(map(int, input().split())))
c = list(map(int, input().split()))
total = n
count = {}
for each in m:
	count[each] = 1 if each not in count else count[each] + 1
ans = 0
total = n
from math import ceil
for i in range(k):
	cnt = count[i + 1] if i + 1 in count else 0
	ans = max(ans, ceil(total / c[i]))
	total -= cnt
arr = [[] for _ in range(ans)]
for i in range(n):
	arr[i % ans] += [m[i]]
print(len(arr))
for each in arr:
	print(len(each), ' '.join((str(k) for k in each)))


(n, k) = map(int, input().split())
test = list(map(int, input().split()))
c = list(map(int, input().split()))
data = [0 for i in range(k + 1)]
for i in range(n):
	data[test[i]] += 1
for i in range(k - 1, -1, -1):
	data[i] += data[i + 1]
ans = 0
index = -1
for i in range(1, k + 1):
	t = (data[i] - 1) // c[i - 1] + 1
	if t > ans:
		ans = t
		index = i
test.sort()
Ans = [[] for i in range(ans)]
pos = 0
for i in range(n - 1, -1, -1):
	Ans[pos].append(test[i])
	pos += 1
	if pos == ans:
		pos = 0
print(ans)
for i in range(ans):
	Ans[i] = [len(Ans[i])] + Ans[i]
	print(*Ans[i])


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def f():
	(n, k) = [int(s) for s in input().split()]
	L = [int(s) for s in input().split()]
	C = [int(s) for s in input().split()]
	cnt = [0] * k
	for l in L:
		cnt[l - 1] += 1
	tmp = 0
	for i in range(k - 1, -1, -1):
		tmp += cnt[i]
		cnt[i] = tmp
	cases = 0
	for i in range(k):
		c = C[i]
		count = cnt[i]
		need = count // c
		if count % c:
			need += 1
		cases = max(cases, need)
	index = list(range(n))
	index.sort(key=lambda x: L[x], reverse=True)
	ans = [[] for _ in range(cases)]
	for i in range(n):
		ans[i % cases].append(L[index[i]])
	print(cases)
	for case in ans:
		print('{} {}'.format(len(case), ' '.join((str(num) for num in case))))
f()


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from functools import *
from collections import deque
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	fact(x, mod)
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa.reverse()

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] > self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

def lcm(a, b):
	return a * b // gcd(a, b)

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None

def topo(n):
	q = deque()
	res = []
	for i in range(1, n + 1):
		if ind[i] == 0:
			q.append(i)
			res.append(i)
	while q:
		u = q.popleft()
		for v in g[u]:
			ind[v] -= 1
			if ind[v] == 0:
				q.append(v)
				res.append(v)
	return res

def cal(x):
	(d, m) = divmod(x, p)
	ans = d * b
	if m:
		if m < b:
			ans += m
		else:
			ans += b - 1
	return ans
t = 1
for i in range(t):
	(n, k) = RL()
	m = RLL()
	c = RLL()
	ans = 0
	cur = 0
	m.sort(reverse=True)
	for x in m:
		cur += 1
		ans = max(ans, (cur + c[x - 1] - 1) // c[x - 1])
	res = [[] for i in range(ans)]
	i = 0
	for x in m:
		res[i].append(x)
		i = (i + 1) % ans
	print(ans)
	for a in res:
		print(len(a), *a)


import math
(n, k) = map(int, input().split(' '))
lst_of_m = list(map(int, input().split(' ')))
lst_of_c = list(map(int, input().split(' ')))
lst_of_m.sort()
dct = {}
count = n
y = lst_of_c[int(lst_of_m[-1]) - 1]
c = 0
for i in lst_of_m:
	if i not in dct:
		count -= c
		c = 0
		x = math.ceil(count / lst_of_c[int(i) - 1])
		dct[int(i)] = x
	c += 1
	if lst_of_c[int(i) - 1] == y:
		break
t = dct[max(dct, key=dct.get)]
lst_ans = []
count = 0
for j in lst_of_m:
	if len(lst_ans) < t:
		lst_ans.append([])
	lst_ans[count % t].append(j)
	count += 1
print(t)
for i in range(t):
	print(len(lst_ans[i]), end=' ')
	print(*lst_ans[i])


import sys
from heapq import heappush, heappop
(n, k) = map(int, sys.stdin.readline().split())
(*m,) = map(int, sys.stdin.readline().split())
(*c,) = map(int, sys.stdin.readline().split())

def main():
	q = [(0, [])]
	cnt = [0] * k
	for x in m:
		cnt[x - 1] += 1
	s = cnt.copy()
	for i in range(k - 1, 0, -1):
		s[i - 1] += s[i]
	tot = 0
	for i in range(k - 1, -1, -1):
		s[i] -= tot
		while s[i] > c[i]:
			s[i] -= 1
			tot += 1
			(v, tmp) = heappop(q)
			if v == c[i]:
				heappush(q, (v, tmp))
				heappush(q, (1, [i + 1]))
			else:
				tmp.append(i + 1)
				heappush(q, (v + 1, tmp))
	res = len(q) + 1
	if q[0][0] == 0:
		res -= 1
	print(res)
	for i in range(k - 1):
		s[i] -= s[i + 1]
	tmp = []
	for i in range(k):
		while s[i]:
			tmp.append(i + 1)
			s[i] -= 1
	print(len(tmp), *tmp, sep=' ')
	for (l, tmp) in q:
		if l == 0:
			continue
		print(l, *tmp, sep=' ')
main()


from collections import Counter
(n, k) = map(int, input().split())
m = sorted(list(map(int, input().split())), reverse=True)
c = [n] + list(map(int, input().split()))
cnt = Counter(m)
tmp = 0
size = 1
for i in range(k, 0, -1):
	tmp += cnt[i]
	size = max(size, (tmp - 1) // c[i] + 1)
ans = [[] for _ in range(size)]
for (i, x) in enumerate(m):
	ans[i % size].append(x)
print(size)
for a in ans:
	print(len(a), *a)


import sys
from math import *

def eprint(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output2.txt', 'w')
(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
d = [0 for i in range(k + 1)]
for i in a:
	d[i] += 1
for i in range(k - 1, 0, -1):
	d[i] += d[i + 1]
cc = 0
for i in range(1, k + 1):
	cc = max(cc, int(ceil(d[i] / c[i - 1])))
if cc == 0:
	cc = 1
z = cc
a.sort(reverse=True)
u = [[] for i in range(cc + 1)]
for j in range(len(a)):
	u[j % cc].append(a[j])
f = 0
eprint(a)
yt = 1
for i in u:
	if len(i) == 0:
		f += 1
print(len(u) - f)
for i in u:
	if len(i) != 0:
		print(len(i), *i)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
M = sorted(map(int, input().split()), reverse=True)
C = list(map(int, input().split()))
import bisect
SIZE = [0] * n
ANS = [[] for i in range(n)]
for m in M:
	s = C[m - 1]
	x = bisect.bisect_left(SIZE, -s + 1)
	SIZE[x] -= 1
	ANS[x].append(m)
print(bisect.bisect_left(SIZE, 0))
for ans in ANS:
	if len(ans) == 0:
		break
	else:
		print(len(ans), *ans)


from sys import stdin, stdout
[n, k] = [int(x) for x in stdin.readline().split()]
m = [int(x) for x in stdin.readline().split()]
k = [int(x) for x in stdin.readline().split()]
m.sort()
summ = 0
minRes = 1
res = []
for i in range(n):
	res.append([])
idx = 1
maxLen = 0
for x in m[::-1]:
	summ += 1
	count = summ // k[x - 1] + (1 if summ % k[x - 1] else 0)
	if count > minRes:
		minRes = count
		res[minRes - 1].append(str(x))
		if idx == 1 and len(res[idx - 1]) > 1:
			idx = minRes
	else:
		res[idx - 1].append(str(x))
		if idx == 1:
			maxLen = len(res[idx - 1])
			if minRes > 1:
				idx += 1
		if len(res[idx - 1]) == maxLen:
			if idx == minRes:
				idx = 1
			else:
				idx += 1
stdout.write(str(minRes) + '\n')
for i in range(minRes):
	stdout.write(str(len(res[i])) + ' ' + ' '.join(res[i]) + '\n')


import time
import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string, heapq as h
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInt():
	return int(input())

def getStrs():
	return input().split()

def getInts():
	return list(map(int, input().split()))

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 10 ** 9 + 7
(N, K) = getInts()
M = getInts()
C = [0] + getInts()
ans = []
counts = [0] * (K + 1)
for m in M:
	counts[m] += 1
for k in range(K, 0, -1):
	idx = 0
	while counts[k]:
		left = -1
		right = len(ans)
		while right - left > 1:
			mid = (left + right) // 2
			if len(ans[mid]) >= C[k]:
				left = mid
			else:
				right = mid
		idx = right
		if idx == len(ans):
			ans.append([])
		num = min(C[k] - len(ans[idx]), counts[k])
		ans[idx] += [k] * num
		counts[k] -= num
		idx += 1
print(len(ans))
for a in ans:
	print(len(a), *a)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = list(map(int, input().split()))
mn = 0
for i in range(n):
	mn = max(mn, (i + s[a[i] - 1]) // s[a[i] - 1])
ret = [[] for i in range(mn)]
for i in range(n):
	ret[i % mn].append(a[i])
print(mn)
for i in range(mn):
	print(len(ret[i]), *ret[i])


def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys
	import heapq
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return map(int, data().split())
	out = sys.stdout.write
	INF = int(1000000000.0)
	(n, k) = mdata()
	M = list(mdata())
	M.sort()
	C = list(mdata())
	d1 = [0] * n
	d2 = [0] * n
	ans = []
	n1 = n - 1
	m = INF
	while n1 >= 0:
		s = bl(d1, C[M[n1] - 1]) - 1
		d2[n1] = s
		d1[s] += 1
		m = min(m, s)
		n1 -= 1
	ans = [[] for i in range(n - m)]
	for i in range(n):
		ans[n - 1 - d2[i]].append(str(M[i]))
	for i in range(len(ans)):
		ans[i] = str(len(ans[i])) + ' ' + ' '.join(ans[i])
	out(str(len(ans)) + '\n')
	out('\n'.join(ans))
main()


(n, k) = map(int, input().split())
f = [0] * (k + 1)
for i in map(int, input().split()):
	f[i] += 1
c = list(map(int, input().split()))
res = [[]]
num_list = [0]
pre_index = 0
for i in range(k, 0, -1):
	index = 0
	if c[i - 1] - num_list[index] == 0:
		index = pre_index
	while f[i] > 0:
		if len(res) <= index:
			res.append([])
			num_list.append(0)
		tmp = min(c[i - 1] - num_list[index], f[i])
		if tmp != 0:
			f[i] -= tmp
			res[index].extend([i] * tmp)
			num_list[index] += tmp
		if f[i] > 0:
			index += 1
	pre_index = index
print(len(res))
for (num, xlist) in zip(num_list, res):
	print(num, ' '.join(map(str, xlist)))


import math
import collections
(n, k) = tuple(map(int, input().split()))
m = sorted(list(map(int, input().split())))
c = list(map(int, input().split()))
g = [1] * n
g[-1] = 1
for i in range(n - 2, -1, -1):
	g[i] += g[i + 1]
ans = 1
for i in range(n):
	ans = max(ans, math.ceil(g[i] / c[m[i] - 1]))
print(ans)
res = collections.defaultdict(list)
for i in range(n):
	res[i % ans].append(m[i])
for i in res:
	print(len(res[i]), end=' ')
	print(*res[i])


import os, sys
from io import BytesIO, IOBase

def check(mid, siz, cap):
	an = [[] for _ in range(mid)]
	j = 0
	for i in siz:
		an[j].append(i)
		if len(an[j]) > cap[i - 1]:
			return -1
		j += 1
		if j == len(an):
			j = 0
	return an

def main():
	(n, k) = map(int, input().split())
	siz = sorted(map(int, input().split()), reverse=1)
	cap = list(map(int, input().split()))
	(hi, lo) = (n, 1)
	while hi >= lo:
		mid = (hi + lo) // 2
		z = check(mid, siz, cap)
		if z == -1:
			lo = mid + 1
		else:
			hi = mid - 1
			ans = mid
			an = z
	print(ans)
	for i in an:
		print(len(i), *i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


nk = input().split()
n = int(nk[0])
k = int(nk[1])
m = list(map(int, input().rstrip().split()))
c = list(map(int, input().rstrip().split()))
m = sorted(m)[::-1]
tc = []
curr_len = k
maxl = c[k - 1]
curr_ind = 0
for i in range(n):
	mi = m[i]
	while mi < curr_len:
		curr_len -= 1
		maxl = c[curr_len - 1]
	if len(tc) == 0:
		tc.append([mi])
	elif len(tc[curr_ind]) == maxl:
		curr_ind = (curr_ind + 1) % len(tc)
		if len(tc[curr_ind]) == maxl:
			curr_ind = len(tc)
			tc.append([mi])
		else:
			tc[curr_ind].append(mi)
	else:
		tc[curr_ind].append(mi)
print(len(tc))
for t in tc:
	t = [len(t)] + t
	print(*t, sep=' ')


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
C = []
tmp = 0
prev = c[0]
c.append(0)
for i in range(k):
	if c[i] != c[i + 1]:
		C.append(i)
m.sort()
r = n
ans = [[] for i in range(n)]
import bisect
M = 0
for i in range(len(C) - 1, -1, -1):
	l = 0
	if i > 0:
		l = bisect.bisect_right(m, C[i - 1] + 1)
	id = 0
	for x in m[l:r]:
		if len(ans[id]) >= c[C[i]]:
			id += 1
		ans[id].append(x)
	M = max(M, id + 1)
	r = l
print(M)
for x in ans[:M]:
	print(len(x), *x)


from sys import stdin
import collections as C
(n, k) = map(int, stdin.readline().strip().split())
v = list(map(int, stdin.readline().strip().split()))
C = list(map(int, stdin.readline().strip().split()))
c = [0]
for x in C:
	c.append(x)
cnt = [0] * (k + 1)
for x in v:
	cnt[x] += 1
for i in range(k - 1, 0, -1):
	cnt[i] += cnt[i + 1]
req = 0
for i in range(1, k + 1):
	s = cnt[i] // c[i]
	if cnt[i] % c[i] != 0:
		s += 1
	req = max(req, s)
v.sort()
ans = []
print(req)
for i in range(req):
	ans.append([])
for i in range(n):
	ans[i % req].append(v[i])
for x in ans:
	print(len(x), end=' ')
	for y in x:
		print(y, end=' ')
	print('')


from sys import stdin, stdout
from bisect import bisect_left
input = stdin.buffer.readline
print = stdout.write
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort()
mx = 0
for (i, u) in enumerate(c):
	cc = n - bisect_left(m, i + 1)
	mx = max(mx, (cc + (u - 1)) // u)
ls = [[] for _ in range(mx)]
for (i, u) in enumerate(reversed(m)):
	ls[i % mx].append(u)
print(str(mx) + '\n')
for tl in ls:
	print(str(len(tl)) + ' ' + ' '.join(map(str, tl)) + '\n')


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort()
count = 0
result = 0
for i in range(n):
	count += 1
	reqd = count // c[m[~i] - 1]
	if count % c[m[~i] - 1] != 0:
		reqd += 1
	result = max(result, reqd)
arrays = [[] for _ in range(result)]
count = [0] * k
for i in range(n):
	count[m[i] - 1] += 1
temp = 0
for i in range(k - 1, -1, -1):
	for j in range(count[i]):
		arrays[temp % result].append(i + 1)
		temp += 1
print(result)
for arr in arrays:
	print(len(arr), *arr)


from random import random

class TreapNode:

	def __init__(self, val, ind):
		self.val = val
		self.priority = random()
		(self.parent, self.right, self.left) = (None, None, None)
		self.ind = ind

class Treap:

	def __init__(self, is_multiset=False):
		self.is_multiset = is_multiset
		self.root = None

	def search(self, val: int) -> bool:
		ptr = self.root
		while ptr is not None:
			if val < ptr.val:
				ptr = ptr.left
			elif val > ptr.val:
				ptr = ptr.right
			else:
				return True
		return False

	def insert(self, val: int, ind: int) -> bool:
		if self.root is None:
			self.root = TreapNode(val, ind)
			return True
		ptr = self.root
		while True:
			if val < ptr.val:
				if ptr.left is None:
					ptr.left = TreapNode(val, ind)
					ptr.left.parent = ptr
					ptr = ptr.left
					break
				ptr = ptr.left
			else:
				if val == ptr.val and (not self.is_multiset):
					return False
				elif ptr.right is None:
					ptr.right = TreapNode(val, ind)
					ptr.right.parent = ptr
					ptr = ptr.right
					break
				ptr = ptr.right
		while ptr.parent is not None and ptr.parent.priority > ptr.priority:
			if ptr.parent.right == ptr:
				self._rotate_left(ptr.parent)
			else:
				self._rotate_right(ptr.parent)
		if ptr.parent is None:
			self.root = ptr
		return True

	def delete(self, val: int) -> True:
		if self.root is None:
			return False
		ptr = self.root
		while True:
			if ptr is None:
				return False
			elif val < ptr.val:
				ptr = ptr.left
			elif val > ptr.val:
				ptr = ptr.right
			else:
				break
		while ptr.left is not None or ptr.right is not None:
			if ptr.left is None:
				self._rotate_left(ptr)
			elif ptr.right is None:
				self._rotate_right(ptr)
			elif ptr.left.priority < ptr.right.priority:
				self._rotate_right(ptr)
			else:
				self._rotate_left(ptr)
			if self.root == ptr:
				self.root = ptr.parent
		if ptr.left is None and ptr.right is None:
			if ptr == self.root:
				self.root = None
			elif ptr.parent.left == ptr:
				ptr.parent.left = None
			else:
				ptr.parent.right = None
		return True

	def _rotate_left(self, ptr):
		w = ptr.right
		w.parent = ptr.parent
		if w.parent is not None:
			if w.parent.left == ptr:
				w.parent.left = w
			else:
				w.parent.right = w
		ptr.right = w.left
		if ptr.right is not None:
			ptr.right.parent = ptr
		ptr.parent = w
		w.left = ptr
		if ptr == self.root:
			self.root = w
			self.root.parent = None

	def _rotate_right(self, ptr):
		w = ptr.left
		w.parent = ptr.parent
		if w.parent is not None:
			if w.parent.right == ptr:
				w.parent.right = w
			else:
				w.parent.left = w
		ptr.left = w.right
		if ptr.left is not None:
			ptr.left.parent = ptr
		ptr.parent = w
		w.right = ptr
		if ptr == self.root:
			self.root = w
			self.root.parent = None

	def search_min(self):
		ptr = self.root
		ret = None
		while ptr is not None:
			ret = ptr.val
			ptr = ptr.left
		return ret

	def search_max(self):
		ptr = self.root
		ret = None
		while ptr is not None:
			ret = ptr.val
			ptr = ptr.right
		return ret

	def search_lt(self, val: int):
		ptr = self.root
		ret = None
		res = None
		while ptr is not None:
			if ptr.val < val:
				ret = ptr.val
				res = ptr
				ptr = ptr.right
			else:
				ptr = ptr.left
		(value, index) = (res.val, res.ind)
		ptr = res
		while ptr.left is not None or ptr.right is not None:
			if ptr.left is None:
				self._rotate_left(ptr)
			elif ptr.right is None:
				self._rotate_right(ptr)
			elif ptr.left.priority < ptr.right.priority:
				self._rotate_right(ptr)
			else:
				self._rotate_left(ptr)
			if self.root == ptr:
				self.root = ptr.parent
		if ptr.left is None and ptr.right is None:
			if ptr == self.root:
				self.root = None
			elif ptr.parent.left == ptr:
				ptr.parent.left = None
			else:
				ptr.parent.right = None
		return (value, index)
import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m = sorted(m, reverse=True)
tp = Treap(n + 1)
for i in range(n):
	tp.insert(0, i)
ans = [[] for i in range(n)]
for i in range(n):
	limit = c[m[i] - 1]
	(val, ind) = tp.search_lt(limit)
	ans[ind].append(m[i])
	tp.insert(val + 1, ind)
cnt = 0
for i in ans:
	if i:
		cnt += 1
print(cnt)
for i in ans:
	if not i:
		continue
	print(len(i), *i)


from bisect import bisect_right
(n, k) = map(int, input().split())
ms = list(map(int, input().split()))
cs = list(map(int, input().split()))
ms = list(reversed(sorted(ms)))
xss = []
neglens = []
for m in ms:
	i = bisect_right(neglens, -cs[m - 1])
	if i == len(neglens):
		xss.append([])
		neglens.append(0)
	xss[i].append(m)
	neglens[i] -= 1
print(len(xss))
for xs in xss:
	print(len(xs), ' '.join(map(str, xs)))


from sys import stdin, stdout
import math, collections, itertools
mod = 998244353
(n, k) = map(int, stdin.readline().split())
arr = sorted(map(int, stdin.readline().split()))[::-1]
c = list(map(int, stdin.readline().split()))
dic = collections.Counter(arr)
size = 0
temp = 0
for i in range(k):
	temp += dic[k - i]
	size = max(size, math.ceil(temp / c[~i]))
ans = [[] for i in range(size)]
for i in range(n):
	ans[i % size].append(arr[i])
stdout.write(str(size) + '\n')
for i in ans:
	print(len(i), *i)


import sys
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(val)
from collections import Counter
from math import ceil

def pigeonhole(totals, restrictions, lengths, i):
	return ceil(totals[i] / restrictions[lengths[i] - 1])

def create_testcases():
	(n, k) = map(int, input().split())
	counts = Counter(map(int, input().split()))
	lengths = sorted(list(counts.keys()), reverse=True)
	totals = [counts[lengths[0]]]
	for i in range(1, len(lengths)):
		totals.append(totals[i - 1] + counts[lengths[i]])
	restrictions = list(map(int, input().split()))
	num_testcases = []
	for i in range(len(lengths)):
		num_testcases.append(pigeonhole(totals, restrictions, lengths, i))
	num_testcases = max(num_testcases)
	testcases = [[] for i in range(num_testcases)]
	curr = 0
	for length in lengths:
		for i in range(counts[length]):
			testcases[curr].append(str(length))
			curr = (curr + 1) % num_testcases
	print(str(num_testcases) + '\n')
	for testcase in testcases:
		print(str(len(testcase)) + ' ' + ' '.join(testcase) + '\n')
create_testcases()


import os
import sys
from collections import defaultdict

def f(ms, cs):
	ms = sorted(ms, reverse=True)
	group = 0
	group_counts = [0] * len(ms)
	gg = []
	for (idx, m) in enumerate(ms):
		cs_idx = min(m, len(cs)) - 1
		if cs[cs_idx] > group_counts[0]:
			group = 0
		if group_counts[group] >= cs[cs_idx]:
			group += 1
		if len(gg) <= group:
			gg.append([m])
		else:
			gg[group].append(m)
		group_counts[group] += 1
	return gg

def pp(input):
	(n, k) = map(int, input().split())
	ms = list(map(int, input().split()))
	cs = list(map(int, input().split()))
	groups = f(ms, cs)
	print(len(groups))
	print('\n'.join((str(len(g)) + ' ' + ' '.join(map(str, g)) for g in groups)))
if 'paalto' in os.getcwd():
	from string_source import string_source
	pp(string_source('6 10\n5 8 1 10 8 7\n6 6 4 4 3 2 2 2 1 1'))
	pp(string_source('5 1\n1 1 1 1 1\n5'))
	pp(string_source('4 3\n1 2 2 3\n4 1 1'))
else:
	pp(iter(sys.stdin.buffer.read().decode().splitlines()).__next__)


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
from heapq import heapreplace, heappush

def go():
	(n, k) = map(int, input().split())
	m = sorted(map(int, input().split()), reverse=True)
	c = list(map(int, input().split()))
	lookup = []
	cur = 0
	for (kk, cnt) in reversed(list(enumerate(c, 1))):
		if cnt > cur:
			lookup.extend([kk] * (cnt - cur))
			cur = cnt
	lookup.append(0)
	res = [[]]
	heap = [(-k, 0)]
	for val in m:
		(avail, index) = heap[0]
		if -avail >= val:
			res[index].append(val)
			new = (-lookup[len(res[index])], index)
			heapreplace(heap, new)
		else:
			res.append([val])
			new = (-lookup[1], len(res) - 1)
			heappush(heap, new)
	result = [str(len(res))]
	for line in res:
		result.append(str(len(line)) + ' ' + ' '.join(map(str, line)))
	return '\n'.join(result)
t = 1
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


(n, k) = map(int, input().split())
sz = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
sz.sort()
sz = sz[::-1]
ans = []
h = []
ans.append(h)
for i in range(0, len(sz)):
	ele = sz[i]
	low = 0
	high = len(ans) - 1
	ind = -1
	while low <= high:
		mid = low + high >> 1
		if c[ele - 1] - len(ans[mid]) > 0:
			ind = mid
			high = mid - 1
		else:
			low = mid + 1
	if ind == -1:
		h2 = []
		ans.append(h2)
	ans[ind].append(ele)
print(len(ans))
for i in ans:
	print(len(i), *i)


import sys
import math
input = sys.stdin.buffer.readline
t = 1
for _ in range(t):
	(n, k) = map(int, input().split())
	m = list(map(int, input().split()))
	c = list(map(int, input().split()))
	c.insert(0, 0)
	m.sort(reverse=True)
	cnt = {}
	maxi = 1
	for i in range(n):
		cnt[i + 1] = []
	prev = c[m[0]]
	j = 1
	for i in range(n):
		if c[m[i]] != prev:
			j = 1
			cnt[j].append(m[i])
		elif len(cnt[j]) >= prev:
			j += 1
			maxi = max(maxi, j)
			cnt[j].append(m[i])
		else:
			cnt[j].append(m[i])
		prev = c[m[i]]
	print(maxi)
	for i in range(1, n + 1):
		if len(cnt[i]) != 0:
			print(len(cnt[i]), end=' ')
		for j in range(len(cnt[i])):
			print(cnt[i][j], end=' ')
		print()


from heapq import *
(n, k) = map(int, input().split())
m = [int(x) for x in input().split()]
m.sort(reverse=True)
c = [int(x) for x in input().split()]
c.insert(0, 0)
tests = [[m[0]]]
h = [(1, 0)]
for mi in m[1:]:
	if h[0][0] >= c[mi]:
		tests.append([mi])
		heappush(h, (1, len(tests) - 1))
		continue
	(l, i) = h[0]
	heappop(h)
	tests[i].append(mi)
	heappush(h, (l + 1, i))
print(len(tests))
for t in tests:
	print(len(t), *t)


(n, k) = map(int, input().split())
L = sorted(list(map(int, input().split())))
cL = list(map(int, input().split()))
cumL = [n] * k
for i in range(n):
	if i != 0 and L[i - 1] < L[i]:
		cumL[L[i - 1]] -= i
dvmax = 0
for i in range(k):
	if i != 0 and cumL[i - 1] < cumL[i]:
		cumL[i] = cumL[i - 1]
	q = cumL[i] // cL[i]
	if cumL[i] % cL[i]:
		q += 1
	if q > dvmax:
		dvmax = q
solL = [[] for i in range(dvmax)]
for i in range(n):
	solL[i % dvmax].append(L[n - i - 1])
print(dvmax)
for i in solL:
	print(len(i), end=' ')
	for j in i:
		print(j, end=' ')
	print()


from collections import defaultdict
(n, k) = [int(i) for i in input().split()]
m = sorted([int(i) for i in input().split()])
c = [int(i) for i in input().split()]
m_count = defaultdict(int)
for i in m:
	m_count[i] += 1
for i in range(k, 0, -1):
	m_count[i - 1] += m_count[i]
cell_needed = max([(m_count[i + 1] + c[i] - 1) // c[i] for i in range(k)])
ans = [[] for i in range(cell_needed)]
counter = 0
for i in m:
	ans[counter].append(i)
	counter += 1
	counter %= cell_needed
print(cell_needed)
for i in range(cell_needed):
	print(len(ans[i]), *ans[i])


(n, k) = map(int, input().split())
m = [0] + list(map(int, input().split()))
c = [0] + list(map(int, input().split()))
m.sort(reverse=True)
ans = 0
for i in range(n):
	ans = max(ans, (i + c[m[i]]) // c[m[i]])
for_print = [[] for j in range(ans)]
for i in range(n):
	for_print[i % ans].append(m[i])
print(ans)
for i in range(ans):
	print(len(for_print[i]), *for_print[i])


import sys
from collections import defaultdict

def possible(num, c, suf):
	n = len(c)
	for i in range(n):
		c[i] *= num
	for i in range(n):
		if c[i] < suf[i]:
			for i in range(n):
				c[i] //= num
			return False
	for i in range(n):
		c[i] //= num
	return True
(n, k) = map(int, sys.stdin.readline().split())
m = list(map(int, sys.stdin.readline().split()))
c = list(map(int, sys.stdin.readline().split()))
l = [0 for _ in range(k + 1)]
m.sort()
for i in range(n - 1, -1, -1):
	l[m[i]] += 1
s = 0
suf = [0 for _ in range(k)]
for i in range(k, 0, -1):
	s += l[i]
	suf[i - 1] = s
low = 1
high = 10000000000000.0
ans = int(10000000000000.0)
while low <= high:
	mid = (low + high) // 2
	if possible(mid, c, suf):
		ans = min(ans, mid)
		high = mid - 1
	else:
		low = mid + 1
ans = int(ans)
res = [[] for i in range(ans)]
ind = n - 1
count = [0 for i in range(ans)]
cur = 0
sub = [0 for i in range(ans)]
while ind >= 0:
	num = m[ind]
	lim = c[num - 1]
	if count[cur] + sub[cur] < lim:
		res[cur].append(num)
		ind -= 1
		count[cur] += 1
	else:
		cur += 1
		cur %= ans
print(ans)
for i in range(ans):
	print(count[i], end=' ')
	print(' '.join((str(x) for x in res[i])))


import math

def solve(n, k, m, c):
	counter_original = [0] * (k + 1)
	counter = [0] * (k + 1)
	for m_i in m:
		counter_original[m_i] += 1
		counter[m_i] += 1
	for i in reversed(range(1, k)):
		counter[i] += counter[i + 1]
	total_cases_needed = 0
	for i in reversed(range(1, k + 1)):
		cases_needed = int(math.ceil(counter[i] / c[i - 1]))
		total_cases_needed = max(total_cases_needed, cases_needed)
	current_cases = [[] for _ in range(total_cases_needed)]
	offset = 0
	for i in reversed(range(1, k + 1)):
		reminder = counter_original[i]
		for _ in range(reminder):
			current_cases[offset % total_cases_needed].append(i)
			offset += 1
	return current_cases

def main():
	(n, k) = map(int, input().split())
	m = list(map(int, input().split()))
	c = list(map(int, input().split()))
	cases = solve(n, k, m, c)
	print(len(cases))
	for case in cases:
		case_data = ' '.join(map(str, case))
		print(f'{len(case)} {case_data}')
main()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bisearch_min(mn, mx, func):
	ok = mx
	ng = mn
	while ng + 1 < ok:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok

def check(m):
	C = [[] for i in range(m)]
	j = 0
	for (i, a) in enumerate(A):
		C[j].append(a)
		j = (j + 1) % m
	for i in range(m):
		for (j, c) in enumerate(C[i]):
			if not B[c] >= j + 1:
				return False
	return True
(N, M) = MAP()
A = LIST()
B = [0] + LIST()
A.sort(reverse=1)
res = bisearch_min(0, N + 1, check)
ans = [[] for i in range(res)]
j = 0
for (i, a) in enumerate(A):
	ans[j].append(a)
	j = (j + 1) % res
print(len(ans))
for i in range(res):
	print(len(ans[i]), *ans[i])


import sys
input = sys.stdin.readline
import bisect
(n, k) = map(int, input().split())
m = [int(item) for item in input().split()]
m.sort()
c = [0] + [int(item) for item in input().split()]
nums = []
c_rev = c[::-1]
max_count = 1
pval = 0
for (i, (c1, c2)) in enumerate(zip(c_rev, c_rev[1:])):
	if c1 == c2:
		continue
	val = k - i
	cnt = n - bisect.bisect_left(m, val)
	nums.append([val, c[val] - c[pval]])
	pval = val
	max_count = max(max_count, (cnt + c[val] - 1) // c[val])
ret = [[] for _ in range(max_count)]
m.reverse()
itr = 0
c = 0
mod = max_count
for (i, item) in enumerate(m):
	ret[i % mod].append(item)
print(max_count)
for line in ret:
	print(len(line), *line)


(n, k) = [int(x) for x in input().split()]
m = list(map(int, input().split()))
ak = list(map(int, input().split()))
ak = ak + [0]
li = []
ans = []
count = 0
tc = 0
for i in range(k + 1):
	li.append(0)
for i in range(n + 1):
	ans.append([])
for i in range(n):
	li[m[i]] += 1
for i in range(k - 1, -1, -1):
	if ak[i] != ak[i + 1]:
		count = 0
	for j in range(li[i + 1]):
		ans[count].append(i + 1)
		if len(ans[count]) == ak[i]:
			count += 1
for i in range(n + 1):
	if len(ans[i]) == 0:
		break
	tc += 1
print(tc)
for i in range(tc):
	print(len(ans[i]), end=' ')
	for j in ans[i]:
		print(j, end=' ')
	print()


import sys
input = lambda : sys.stdin.readline().strip()
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort(reverse=True)
g = 0
ans = 0
for i in range(k, 0, -1):
	while g < n and m[g] == i:
		g += 1
	ans = max(ans, (g + c[i - 1] - 1) // c[i - 1])
res = [[] for _ in range(ans)]
for i in range(n):
	res[i % ans].append(m[i])
print(ans)
for i in res:
	print(len(i), end=' ')
	print(' '.join(map(str, i)))


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	from bisect import bisect_left
	input = sys.stdin.readline
	(N, K) = map(int, input().split())
	M = list(map(int, input().split()))
	C = list(map(int, input().split()))
	M.sort()
	C = [0] + C
	ans = []
	L = [-N - 1]
	for _ in range(N):
		m = M.pop()
		c = C[m]
		i = bisect_left(L, -c + 1)
		if i == len(L):
			L.append(-1)
			ans.append([m])
		else:
			L[i] -= 1
			ans[i - 1].append(m)
	print(len(ans))
	for A in ans:
		print(len(A), *A)
main()


import sys
input = sys.stdin.readline
(N, K) = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X = X[::-1]
Y = list(map(int, input().split()))
Y = Y[::-1]
C = []
j = 0
for i in range(K, 0, -1):
	while j < len(X) and X[j] >= i:
		j += 1
	C.append(j)
mx = 0
for i in range(K):
	mx = max(mx, -(-C[i] // Y[i]))
R = [[] for _ in range(mx)]
for i in range(N):
	R[i % mx].append(str(X[i]))
print(len(R))
for r in R:
	print(len(r), ' '.join(r))


import heapq
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
arr2 = [0] + list(map(int, input().split()))
ans = [[] for _ in range(n)]
q = []
heapq.heappush(q, (0, 0))
right = 1
for i in range(n):
	(cnt, pos) = heapq.heappop(q)
	if cnt + 1 <= arr2[arr[i]]:
		ans[pos].append(arr[i])
		heapq.heappush(q, (cnt + 1, pos))
	else:
		ans[right].append(arr[i])
		heapq.heappush(q, (cnt, pos))
		heapq.heappush(q, (1, right))
		right += 1
cnt = 0
for i in range(n):
	if len(ans[i]) == 0:
		break
	else:
		cnt += 1
		ans[i] = [len(ans[i])] + ans[i]
print(cnt)
for i in range(cnt):
	print(*ans[i])


import sys
input = sys.stdin.buffer.readline
(n, k) = map(int, input().split())
(*m,) = map(int, input().split())
(*c,) = map(int, input().split())
m.sort(reverse=True)
(l, r) = (0, n + 1)
prov = None
while r - l > 1:
	mid = (l + r) // 2
	f = 1
	step = 0
	turn = 1
	arr = [[] for _ in range(mid)]
	for x in m:
		if c[x - 1] < turn:
			f = 0
			break
		arr[step].append(x)
		step += 1
		if step == mid:
			step = 0
			turn += 1
	if f:
		r = mid
		prov = arr
	else:
		l = mid
print(r)
ans = []
for l in prov:
	ans.append(' '.join([str(len(l))] + list(map(str, l))))
print('\n'.join(ans))


import math
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort()
howmany = []
current = 1
tempmax = 0
for i in range(n):
	if m[i] >= current:
		tempmax = m[i]
		for j in range(m[i] + 1 - current):
			howmany.append(n - i)
		current = m[i] + 1
tempsize = len(howmany)
if tempsize < k:
	for i in range(k - tempsize):
		howmany.append(0)
m.reverse()
minimum = 0
for i in range(k):
	if math.ceil(howmany[i] / c[i]) > minimum:
		minimum = math.ceil(howmany[i] / c[i])
print(minimum)
totalprinted = 0
temp2 = 0
while temp2 < minimum:
	temp = temp2
	t = math.ceil((n - totalprinted) / (minimum - temp2))
	if (t + 1) * (minimum - temp2) <= n - totalprinted:
		t += 1
	print(t)
	while temp < n:
		print(m[temp])
		temp += minimum
		totalprinted += 1
	temp2 += 1


from collections import Counter as cc
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n, k) = I()
l = sorted(I())
d = cc(l)
c = I()
t = [[] for i in range(n)]
p = [0] * k
p[0] = n
an = n // c[0] + (n % c[0] != 0)
for i in range(1, k):
	p[i] = p[i - 1] - d.get(i, 0)
	an = max(an, p[i] // c[i] + (p[i] % c[i] != 0))
for i in range(an):
	j = i
	while j < n:
		t[i].append(l[j])
		j += an
print(an)
for i in range(an):
	print(len(t[i]), *t[i])


from sys import stdin, stdout
from math import gcd
(n, m) = map(int, stdin.readline().strip().split())
s = list(map(int, stdin.readline().strip().split()))
s1 = list(map(int, stdin.readline().strip().split()))
global ans
ans = []

def can(x):
	global ans
	y = []
	z = 0
	ans = [[] for i in range(x)]
	for i in range(n):
		ans[i % x].append(s[i])
	for i in range(x):
		acum = 0
		for j in range(len(ans[i]) - 1, -1, -1):
			if s1[ans[i][j] - 1] - acum <= 0:
				return False
			acum += 1
	return True
s.sort()
l = 1
r = n
while r - l > 1:
	mid = (l + r) // 2
	if can(mid):
		r = mid
	else:
		l = mid
for i in range(l - 1, r + 1):
	if i == 0:
		continue
	if can(i):
		break
print(len(ans))
for i in ans:
	print(len(i), *i)


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getInts():
	return list(map(int, input().split()))
(N, K) = getInts()
M = getInts()
C = [0] + getInts()
ans = []
counts = [0] * (K + 1)
for m in M:
	counts[m] += 1
for k in range(K, 0, -1):
	idx = 0
	while counts[k]:
		left = -1
		right = len(ans)
		while right - left > 1:
			mid = (left + right) // 2
			if len(ans[mid]) >= C[k]:
				left = mid
			else:
				right = mid
		idx = right
		if idx == len(ans):
			ans.append([])
		num = min(C[k] - len(ans[idx]), counts[k])
		ans[idx] += [k] * num
		counts[k] -= num
		idx += 1
print(len(ans))
for a in ans:
	print(len(a), *a)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
c = [0] + c
cnt = [0] * (k + 1)
cum = [0] * (k + 1)
div = [0] * (k + 1)
for num in m:
	cnt[num] += 1
cum[k] = cnt[k]
for i in range(k - 1, 0, -1):
	cum[i] = cum[i + 1] + cnt[i]
for i in range(1, k + 1):
	div[i] = cum[i] // c[i] + bool(cum[i] % c[i])
ans = max(div)
sol = [[] for _ in range(ans)]
m.sort()
for i in range(len(m)):
	sol[i % ans].append(m[i])
print(ans)
for s in sol:
	temp = [len(s)] + s
	print(*temp)


import bisect
from math import ceil
(N, K) = map(int, input().split())
M = list(map(int, input().split()))
C = list(map(int, input().split()))
div = 1
M = sorted(M)
for (val, cnt) in zip(reversed(range(1, K + 1)), reversed(C)):
	over_cnt = N - bisect.bisect_left(M, val)
	if over_cnt > cnt:
		div = max(div, ceil(over_cnt / cnt))
ans = [[] for _ in range(div)]
for (i, a) in enumerate(M):
	ans[i % div].append(a)
print(div)
for a in ans:
	print('{} {}'.format(len(a), ' '.join(map(str, a))))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split(' '))
ln = [int(i) for i in input().split(' ')]
lk = [int(i) for i in input().split(' ')]
ln.sort(reverse=True)
ans = {}
d = {}
ctr = 0
kp = 1
mn = 0
for (pi, i) in enumerate(ln):
	mn = max(mn, pi // lk[i - 1] + 1)
for (pi, i) in enumerate(ln):
	cur = pi % mn
	if cur not in ans:
		ans[cur] = []
	ans[cur].append(i)
print(len(ans))
for (k, v) in ans.items():
	print(len(v), *v)


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(N, K) = map(int, input().split())
M = sorted(map(int, input().split()), reverse=True)
C = list(map(int, input().split()))
C = [C[0]] + C
L = [0] * (K + 1)
for m in M:
	L[m] += 1
cumL = L[:]
for i in range(K, 0, -1):
	cumL[i - 1] += cumL[i]
ans = 1
for (l, c) in zip(cumL, C):
	ans = max(ans, -(-l // c))
print(ans)
for i in range(ans):
	an = M[i::ans]
	print(len(an), ' '.join(map(str, an)))


import sys
import math

class IoTool:
	DEBUG = 0

	def _reader_dbg():
		with open('./input.txt', 'r') as f:
			lines = f.readlines()
		for l in lines:
			yield l.strip()

	def _reader_oj():
		return iter(sys.stdin.read().split('\n'))
	reader = _reader_dbg() if DEBUG else _reader_oj()

	def read():
		return next(IoTool.reader)
input = IoTool.read

def main():
	(n, k) = map(int, input().split())
	arrs = list(map(int, input().split()))
	cons = [n] + list(map(int, input().split()))
	arrs.sort()
	import bisect
	ans = max([math.ceil((n - bisect.bisect_left(arrs, m)) / cons[m]) for m in arrs])
	out = [[] for _ in range(ans)]
	for (idx, v) in enumerate(arrs):
		out[idx % ans].append(v)
	print(ans)
	for arr in out:
		print(len(arr), *arr)
main()


import math
inp = lambda : map(int, input().split(' '))
(n, k) = inp()
a1 = sorted(list(inp()), reverse=True)
c1 = list(inp())
num = 0
for (idx, val) in enumerate(a1, 1):
	num = max(num, math.ceil(idx / c1[val - 1]))
res = [[] for i in range(num)]
for (id, val) in enumerate(a1):
	idx = math.ceil(id % num)
	res[idx].append(str(val))
print(num)
for i in res:
	print('{} {}'.format(len(i), ' '.join(i)))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
M = list(map(int, input().split()))
C = list(map(int, input().split()))
M.sort(reverse=True)
ans = [[] for i in range(n)]
size = [0] * n
seti = set()
for m in M:
	s = C[m - 1]
	x = bisect_left(size, -s + 1)
	size[x] -= 1
	ans[x].append(m)
	seti.add(x)
print(len(seti))
for i in ans:
	if len(i) == 0:
		break
	print(len(i), *i)


from math import ceil
(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = list(map(int, input().split()))
m.sort()
ct = [0] * k
ans = 0
for i in range(n):
	ct[m[i] - 1] += 1
for i in range(k - 2, -1, -1):
	ct[i] += ct[i + 1]
for i in range(k):
	ans = max(ans, ceil(ct[i] / c[i]))
an = [[] for i in range(ans)]
print(ans)
for i in range(n):
	an[i % ans].append(m[i])
for i in an:
	print(len(i), end=' ')
	for j in i:
		print(j, end=' ')
	print('')


import sys
input = sys.stdin.buffer.readline

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))
(n, k) = [int(x) for x in input().split()]
m = [int(x) for x in input().split()]
c = [float('inf')] + [int(x) for x in input().split()]
m.sort()
mHowManyLarger = [c[x] for x in m]
testCases = []
for i in range(n - 1, -1, -1):
	size = m[i]
	maxLarger = mHowManyLarger[i]
	if len(testCases) == 0:
		testCases.append([size])
	else:
		b = len(testCases)
		testCase = -1
		while b > 0:
			while testCase + b < len(testCases) and len(testCases[testCase + b]) + 1 > maxLarger:
				testCase += b
			b //= 2
		testCase += 1
		if testCase == len(testCases):
			testCases.append([size])
		else:
			testCases[testCase].append(size)
ans = []
for testCase in testCases:
	ans.append([len(testCase)] + testCase)
print(len(ans))
multiLineArrayOfArraysPrint(ans)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	inf = 10 ** 9
	(n, k) = MI()
	mm = LI()
	cc = [-1] + LI()
	cnt = [0] * (k + 1)
	for m in mm:
		cnt[m] += 1
	for i in range(k - 1, 0, -1):
		cnt[i] += cnt[i + 1]
	mx = 0
	for (ct, c) in zip(cnt[1:], cc[1:]):
		mx = max(mx, (ct + c - 1) // c)
	print(mx)
	ans = [[] for _ in range(mx)]
	mm.sort()
	for (i, m) in enumerate(mm):
		ans[i % mx].append(m)
	for row in ans:
		print(len(row), *row)
main()


from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def powmod(a, b):
	a %= mod
	if a == 0:
		return 0
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % mod
		a = a * a % mod
		b >>= 1
	return res

def main():
	(n, k) = mi()
	a = li()
	c = li()
	a.sort()
	i = 0
	pos = [0] * (k + 1)
	m = [0] * (k + 1)
	for i in a:
		m[i] += 1
	pos[k] = m[k]
	for i in range(k - 1, 0, -1):
		pos[i] = pos[i + 1] + m[i]
	ans = 0
	for i in range(1, k + 1):
		ans = max(ans, ceil(pos[i] / c[i - 1]))
	print(ans)
	a.sort()
	res = [[] for i in range(ans)]
	for i in range(n):
		res[i % ans].append(a[i])
	for i in res:
		print(len(i), end=' ')
		print(*i)
main()


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7

def getlist():
	return list(map(int, input().split()))

def main():
	(N, K) = getlist()
	M = sorted(getlist())
	C = getlist()
	cnt = 1
	for i in range(N):
		x = 1 + i
		y = C[M[N - 1 - i] - 1]
		if x % y == 0:
			cnt = max(cnt, int(x // y))
		else:
			cnt = max(cnt, int(x // y) + 1)
	ans = [[0] for i in range(cnt)]
	for i in range(N):
		ans[i % cnt].append(M[-1 - i])
	for i in range(cnt):
		ans[i][0] = len(ans[i]) - 1
	print(cnt)
	for i in range(cnt):
		print(' '.join(list(map(str, ans[i]))))
main()


import heapq
from collections import defaultdict
from sys import stdin
input = stdin.readline
INF = 10 ** 9 + 7
MAX = 10 ** 7 + 7
MOD = 10 ** 9 + 7
(n, k) = [int(x) for x in input().strip().split()]
a = [int(x) for x in input().strip().split()]
c = [int(x) for x in input().strip().split()]
ans = []
d = defaultdict(list)
for ai in a:
	d[c[ai - 1]].append(ai)
(h, hc) = ([], [])
for di in d:
	heapq.heappush(h, [di, d[di]])
while h:
	temp = []
	while h and len(temp) < h[0][0]:
		(topc, topl) = heapq.heappop(h)
		while topl and len(temp) < topc:
			temp.append(topl.pop())
		if topl:
			heapq.heappush(hc, [topc, topl])
	h = hc
	hc = []
	ans.append(temp)
print(len(ans))
for ai in ans:
	print(len(ai), end=' ')
	print(*ai)


(n, k) = map(int, input().split())
(*m,) = map(int, input().split())
(*c,) = map(int, input().split())
m.sort(reverse=True)
hi = len(m)
lo = 1

def check(size):
	ans = [[] for _ in range(size)]
	cprogress = len(c) - 1
	i = 0
	while i < n:
		for ansi in range(size):
			while m[i] < cprogress + 1 and cprogress >= 0:
				cprogress -= 1
			ans[ansi].append(m[i])
			if cprogress != -1 and len(ans[ansi]) > c[cprogress]:
				return []
			i += 1
			if i >= n:
				break
	return ans
while lo < hi:
	mid = (lo + hi) // 2
	if check(mid):
		hi = mid
	else:
		lo = mid + 1
ans = check(lo)
print(len(ans))
for row in ans:
	print(len(row), ' '.join(map(str, row)))


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
arr = [0] + list(map(int, input().split()))
d = {}
for i in a:
	d[i] = d.get(i, 0) + 1
s = 0
ma = -1
for i in range(k, 0, -1):
	s += d.get(i, 0)
	if s:
		ma = max(ma, math.ceil(s / arr[i]))
ans = [[] for i in range(ma)]
ind = 0
for i in a:
	ans[ind].append(i)
	ind += 1
	ind %= ma
print(ma)
for i in ans:
	print(len(i), *i)


import math
(n, k) = list(map(int, input().split()))
m = list(map(int, input().split()))
c = list(map(int, input().split()))
c = [0] + c
num_of_m = {}
m_cum = {}
for i in range(k):
	num_of_m[i + 1] = 0
for i in range(len(m)):
	num_of_m[m[i]] += 1
temp = 0
for i in range(k, 0, -1):
	temp += num_of_m[i]
	m_cum[i] = temp
ans = 0
for i in range(1, k + 1, 1):
	ans = max(ans, math.ceil(m_cum[i] / c[i]))
multiple_test_cases = []
for i in range(ans):
	multiple_test_cases.append([])
m.sort(reverse=True)
for i in range(len(m)):
	multiple_test_cases[i % ans].append(m[i])
print(len(multiple_test_cases))
for i in range(len(multiple_test_cases)):
	print(len(multiple_test_cases[i]), end=' ')
	for j in range(len(multiple_test_cases[i])):
		print(multiple_test_cases[i][j], end=' ')
	print()


(n, k) = list(map(int, input().split()))
ms = sorted(list(map(int, input().split())))
cs = list(map(int, input().split()))
d = [0] * (k + 1)
for m in ms:
	d[m] += 1
sums = [0] * (k + 1)
sums[k] = d[k]
for i in range(k - 1, 0, -1):
	sums[i] = sums[i + 1] + d[i]
sums = sums[1:]
ans = -1
for i in range(k):
	ans = max(ans, (sums[i] + cs[i] - 1) // cs[i])
print(ans)
for i in range(ans):
	res = [str(ms[j]) for j in range(n - 1 - i, -1, -ans)]
	print(len(res), end=' ')
	print(' '.join(res))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a)
ans = [0] * n
inc = [0] * n
grp = 0
for i in range(0, len(a)):
	temp = (len(a) - i) // c[a[i] - 1]
	if (len(a) - i) % c[a[i] - 1] == 0 and temp != 0:
		grp = max(grp, temp)
	else:
		grp = max(grp, temp + 1)
arrayofgrps = [[] for i in range(0, grp + 1)]
for i in range(len(a) - 1, -1, -1):
	arrayofgrps[i % grp + 1].append(a[i])
print(grp)
for i in range(1, grp + 1):
	print(len(arrayofgrps[i]), end=' ')
	print(*arrayofgrps[i])


from math import ceil
(n, m) = [int(c) for c in input().split()]
a = [int(c) for c in input().split()]
b = [int(c) for c in input().split()]
b.insert(0, 0)
cnt = [0 for i in range(m + 1)]
for i in a:
	cnt[i] += 1
for i in range(len(cnt) - 2, -1, -1):
	cnt[i] += cnt[i + 1]
ans = max([ceil(i / j) for (i, j) in zip(cnt[1:], b[1:])])
a.sort()
anss = [[] for i in range(ans)]
for i in range(n):
	anss[i % ans].append(a[i])
print(ans)
for i in anss:
	print(len(i), *i)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
ms = [0] * k
c = list(map(int, input().split()))
for i in range(n):
	ms[m[i] - 1] += 1
arrs = [0] * k
arrs[-1] = ms[-1]
for i in range(k - 1):
	arrs[-2 - i] = arrs[-1 - i] + ms[-2 - i]
ma = 0
for i in range(k):
	r = arrs[i] // c[i]
	if r * c[i] < arrs[i]:
		r += 1
	ma = max(ma, r)
print(ma)
m.sort()
sol = [0] * ma
for i in range(ma):
	sol[i] = [0]
for i in range(n):
	sol[i % ma].append(m[i])
	sol[i % ma][0] += 1
for i in range(ma):
	print(*sol[i])


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def main():
	(n, k) = map(int, input().split())
	M = list(map(int, input().split()))
	M.sort(reverse=True)
	C = list(map(int, input().split()))
	Ans = []

	def search(Ans, m, judge):
		ng = 0
		ok = len(Ans)
		while ok - ng > 1:
			mid = (ng + ok) // 2
			if len(Ans[mid]) < judge:
				ok = mid
			else:
				ng = mid
		return ok
	for m in M:
		judge = C[m - 1]
		if not Ans or len(Ans[-1]) >= judge:
			Ans.append([m])
		elif len(Ans[0]) < judge:
			Ans[0].append(m)
		else:
			idx = search(Ans, m, judge)
			Ans[idx].append(m)
	sys.stdout.write(str(len(Ans)) + '\n')
	for ans in Ans:
		sys.stdout.write(str(len(ans)) + ' ')
		sys.stdout.write(' '.join(map(str, ans)) + '\n')
main()


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List
(N, K) = map(int, input().split())
A = [int(x) for x in input().split()]
C = [0] + [int(x) for x in input().split()]
A.sort()
wca = collections.Counter(A)
vs = list(sorted(wca.keys()))
suffsum = [0]
for v in reversed(vs):
	suffsum.append(suffsum[-1] + wca[v])
suffsum = suffsum[::-1][:-1]
s = 0
greater = [0 for _ in range(K + 1)]
if vs[0] <= K:
	greater[vs[0]] = suffsum[0]
for i in range(len(vs) - 1):
	if vs[i] > K:
		break
	for j in range(vs[i] + 1, min(vs[i + 1], K) + 1):
		greater[j] = suffsum[i + 1]
if vs[-1] <= K:
	greater[vs[-1]] = suffsum[-1]
m = max([greater[i] // C[i] if greater[i] % C[i] == 0 else greater[i] // C[i] + 1 for i in range(1, K + 1)])
ans = [[] for _ in range(m)]
for (i, v) in enumerate(A):
	ans[i % m].append(v)
print(m)
for v in ans:
	print('{} {}'.format(len(v), ' '.join(map(str, v))))


import math, sys
input = sys.stdin.readline

def main():
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	A.sort()
	j = 0
	G = [0 for i in range(k + 1)]
	V = [0 for i in range(k + 1)]
	for i in range(1, k + 1):
		while j < n:
			if A[j] < i:
				j = j + 1
			else:
				break
		V[i] = n - j
		G[i] = math.ceil((n - j) / B[i - 1])
	v = max(G)
	i = G.index(v)
	print(v)
	for i in range(v):
		print(len(A[i::v]), end=' ')
		print(*A[i::v], end=' ')
		print()
main()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def check(size):
	suf = [1] * (k + 1)
	for i in range(k, 0, -1):
		suf[i] = arr[i - 1] * size
	res = 0
	for i in range(k, 0, -1):
		res += (cnt[i], 0)[i not in cnt.keys()]
		if suf[i] < res:
			return False
	return True
(n, k) = sp()
m = l()
arr = l()
cnt = c(m)
(low, high) = (1, n)
answer = 0
while low <= high:
	mid = (low + high) // 2
	if check(mid):
		answer = mid
		high = mid - 1
	else:
		low = mid + 1
out(answer)
temp = answer
(answer, index) = ([[] for i in range(temp)], 0)
m.sort(reverse=True)
for i in m:
	answer[index].append(i)
	index += 1
	if index == temp:
		index = 0
for i in answer:
	out(len(i), end=' ')
	out(*i)


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():
	(n, k) = map(int, input().split())
	mm = [int(a) for a in input().split()]
	cc = [0] + [int(a) for a in input().split()]
	counts = [0] * (k + 1)
	for m in mm:
		counts[m] += 1
	cases = (counts[k] - 1) // cc[k] + 1
	for i in range(k - 1, 0, -1):
		counts[i] += counts[i + 1]
		cases = max(cases, (counts[i] - 1) // cc[i] + 1)
	print(cases)
	res = [[] for _ in range(cases)]
	mm.sort(reverse=True)
	for i in range(n):
		res[i % cases].append(mm[i])
	for case in res:
		print(len(case), ' '.join(map(str, case)))
main()


import sys
from collections import Counter
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	(n, k) = (next(ints) for i in range(2))
	m = sorted([next(ints) for i in range(n)])
	c = [next(ints) for i in range(k)]
	a = {}
	for i in range(n):
		if m[i] not in a:
			a[m[i]] = (n - i, c[m[i] - 1])
	ans = max(((x + y - 1) // y for (x, y) in a.values()))
	tests = [[] for i in range(ans)]
	for i in range(n):
		tests[i % ans].append(m[i])
	print(ans)
	for t in tests:
		print(len(t), *t)
	return
main()


(n, k) = map(int, input().split())
M = list(map(int, input().split()))
C = list(map(int, input().split()))
M.sort()
G = [0] * k
import bisect
for i in range(1, k + 1):
	j = bisect.bisect_left(M, i)
	G[i - 1] = n - j
ans = -1
import math
for i in range(k):
	ans = max(ans, math.ceil(G[i] / C[i]))
M.sort(reverse=True)
L = [[] for _ in range(ans)]
for i in range(n):
	L[i % ans].append(M[i])
print(ans)
for i in range(ans):
	print(len(L[i]), *L[i])