There is a river of width $n$. The left bank of the river is cell $0$ and the right bank is cell $n + 1$ (more formally, the river can be represented as a sequence of $n + 2$ cells numbered from $0$ to $n + 1$). There are also $m$ wooden platforms on a river, the $i$-th platform has length $c_i$ (so the $i$-th platform takes $c_i$ consecutive cells of the river). It is guaranteed that the sum of lengths of platforms does not exceed $n$.

You are standing at $0$ and want to reach $n+1$ somehow. If you are standing at the position $x$, you can jump to any position in the range $[x + 1; x + d]$. However you don't really like the water so you can jump only to such cells that belong to some wooden platform. For example, if $d=1$, you can jump only to the next position (if it belongs to the wooden platform). You can assume that cells $0$ and $n+1$ belong to wooden platforms.

You want to know if it is possible to reach $n+1$ from $0$ if you can move any platform to the left or to the right arbitrary number of times (possibly, zero) as long as they do not intersect each other (but two platforms can touch each other). It also means that you cannot change the relative order of platforms.

Note that you should move platforms until you start jumping (in other words, you first move the platforms and then start jumping).

For example, if $n=7$, $m=3$, $d=2$ and $c = [1, 2, 1]$, then one of the ways to reach $8$ from $0$ is follow:

 [Image] The first example: $n=7$. 


-----Input-----

The first line of the input contains three integers $n$, $m$ and $d$ ($1 \le n, m, d \le 1000, m \le n$) — the width of the river, the number of platforms and the maximum distance of your jump, correspondingly.

The second line of the input contains $m$ integers $c_1, c_2, \dots, c_m$ ($1 \le c_i \le n, \sum\limits_{i=1}^{m} c_i \le n$), where $c_i$ is the length of the $i$-th platform.


-----Output-----

If it is impossible to reach $n+1$ from $0$, print NO in the first line. Otherwise, print YES in the first line and the array $a$ of length $n$ in the second line — the sequence of river cells (excluding cell $0$ and cell $n + 1$).

If the cell $i$ does not belong to any platform, $a_i$ should be $0$. Otherwise, it should be equal to the index of the platform ($1$-indexed, platforms are numbered from $1$ to $m$ in order of input) to which the cell $i$ belongs.

Note that all $a_i$ equal to $1$ should form a contiguous subsegment of the array $a$ of length $c_1$, all $a_i$ equal to $2$ should form a contiguous subsegment of the array $a$ of length $c_2$, ..., all $a_i$ equal to $m$ should form a contiguous subsegment of the array $a$ of length $c_m$. The leftmost position of $2$ in $a$ should be greater than the rightmost position of $1$, the leftmost position of $3$ in $a$ should be greater than the rightmost position of $2$, ..., the leftmost position of $m$ in $a$ should be greater than the rightmost position of $m-1$.

See example outputs for better understanding.


-----Examples-----
Input
7 3 2
1 2 1

Output
YES
0 1 0 2 2 0 3 

Input
10 1 11
1

Output
YES
0 0 0 0 0 0 0 0 0 1 

Input
10 1 5
2

Output
YES
0 0 0 0 1 1 0 0 0 0 



-----Note-----

Consider the first example: the answer is $[0, 1, 0, 2, 2, 0, 3]$. The sequence of jumps you perform is $0 \rightarrow 2 \rightarrow 4 \rightarrow 5 \rightarrow 7 \rightarrow 8$.

Consider the second example: it does not matter how to place the platform because you always can jump from $0$ to $11$.

Consider the third example: the answer is $[0, 0, 0, 0, 1, 1, 0, 0, 0, 0]$. The sequence of jumps you perform is $0 \rightarrow 5 \rightarrow 6 \rightarrow 11$.

Difficulty: MEDIUM_HARD

Solutions:
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, floor
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	(n, m, d) = RL()
	arr = RLL()
	sp = n - sum(arr)
	tm = m + 1
	maxm = sp / tm
	if maxm > d - 1:
		print('NO')
	else:
		pre = 0
		res = [0] * n
		for (i, v) in enumerate(arr):
			if sp > 0:
				ad = min(sp, d - 1)
				pre += ad
				sp -= ad
			for j in range(pre, pre + v):
				res[j] = i + 1
			pre += v
		print('YES')
		print(*res)
main()


import sys
(n, m, d) = map(int, sys.stdin.readline().split())
p = [0] + list(map(int, sys.stdin.readline().split()))
w = [0] * (n + 2)
idx = n
judge = False
if n < sum(p):
	print('NO')
else:
	for i in range(len(p) - 1, 0, -1):
		width = p[i]
		for j in range(idx, 0, -1):
			if width == 0:
				break
			w[j] = i
			idx -= 1
			width -= 1
	end_idx = idx + 1
	st_idx = 0
	for i in range(1, len(p)):
		count = p[i]
		if end_idx - st_idx <= d:
			print('YES')
			res = w[1:-1]
			res = list(map(str, res))
			res = ' '.join(res)
			print(res)
			judge = True
			break
		else:
			dist = abs(d - (end_idx - st_idx))
			for j in range(count):
				temp = w[end_idx]
				w[end_idx - dist] = temp
				w[end_idx] = 0
				st_idx = end_idx - dist
				end_idx += 1
	for k in range(n, 0, -1):
		if w[k] != 0:
			break
	if n - k >= d:
		print('NO')
	elif end_idx - st_idx <= d and judge == False:
		print('YES')
		res = w[1:-1]
		res = list(map(str, res))
		res = ' '.join(res)
		print(res)


(n, m, d) = map(int, input().split())
arr = list(map(int, input().split()))
d -= 1
if sum(arr) + (len(arr) + 1) * d < n:
	print('NO')
	exit()
print('YES')
w = n - sum(arr)
res = [0] * n
ptr = 0
for i in range(m):
	ne = min(w, d)
	w -= ne
	for j in range(ptr + ne, ptr + ne + arr[i]):
		res[j] = i + 1
	ptr += ne + arr[i]
print(*res)


import math
s = input().split(' ')
n = int(s[0])
m = int(s[1])
d = int(s[2])
c = input().split(' ')
tot = 0
for i in range(0, m):
	c[i] = int(c[i])
	tot += c[i]
left = n - tot
if left > (d - 1) * (m + 1):
	print('NO')
else:
	print('YES')
	now = 1
	for i in range(0, m):
		for j in range(0, min(left, d - 1)):
			print('0', end=' ')
			now += 1
		left -= min(left, d - 1)
		for j in range(0, c[i]):
			print(i + 1, end=' ')
			now += 1
	for j in range(0, min(left, d - 1)):
		print('0', end=' ')
		now += 1
	print('')


import math
import sys
import collections
input = sys.stdin.readline

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def pow(x, y, mod):
	r = 1
	x = x % mod
	while y > 0:
		if y & 1:
			r = r * x % mod
		y = y >> 1
		x = x * x % mod
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))
(n, m, jump) = mi()
d = li()
state = [0] * n
c = []
t = n - 1
for i in range(m - 1, -1, -1):
	c.append([t - d[i] + 1, t])
	t = t - d[i]
c.reverse()
pos = -1
f = False
for i in range(m):
	if pos + jump >= c[i][0]:
		f = True
		break
	else:
		delta = c[i][0] - (pos + jump)
		c[i][0] -= delta
		c[i][1] -= delta
		pos = c[i][1]
if f or pos + jump >= n:
	print('YES')
	for i in range(m):
		for j in range(c[i][0], c[i][1] + 1):
			state[j] = i + 1
	prr(state)
else:
	print('NO')


from sys import stdin, stdout
from sys import stdin
(n, m, d) = map(int, stdin.readline().strip().split())
s = list(map(int, stdin.readline().strip().split()))
acum = [0 for i in range(m)]
acum[-1] = s[-1]
for i in range(m - 2, -1, -1):
	acum[i] = s[i] + acum[i + 1]
acum.append(0)
l = 0
ans = [0 for i in range(n)]
aux = []
mx = 0
for i in range(m):
	rr = 9
	for j in range(l, l + d):
		y = s[i] + j
		rr = j
		if n - y - 1 < acum[i + 1]:
			break
	l = y
	mx = y
	aux.append(rr)
mx += d - 1
ans = [0 for i in range(n)]
for i in range(m):
	for j in range(aux[i], s[i] + aux[i]):
		ans[j] = i + 1
if mx >= n:
	print('YES')
	print(*ans)
else:
	print('NO')


(n, m, d) = [int(x) for x in input().split(' ')]
c = [int(x) for x in input().split(' ')]
if sum([max(y - 1, 0) for y in c]) + (m + 1) * d < n + 1:
	print('NO')
else:
	z = n - sum(c)
	print('YES')
	ans = [0] * min(z, d - 1)
	z -= min(z, d - 1)
	for (i, y) in enumerate(c):
		ans += [i + 1] * y + [0] * min(z, d - 1)
		z -= min(z, d - 1)
	while len(ans) > n:
		ans.remove(0)
	print(*ans)


(n, m, d) = map(int, input().split())
platforms = list(map(int, input().split()))
river = [0 for i in range(n + 2)]
summa = sum(platforms)
maxlengap = d - 1
lenofallgaps = n - summa
maxamountofgaps = m + 1
if summa + maxlengap * maxamountofgaps < n:
	print('NO')
	exit()
elif lenofallgaps == 0:
	pos = 0
	for i in range(len(platforms)):
		for p in range(pos + 1, pos + platforms[i] + 1):
			river[p] = i + 1
		pos += platforms[i]
else:
	gaps = []
	c = lenofallgaps // maxlengap
	for _ in range(lenofallgaps // maxlengap):
		gaps.append(maxlengap)
	if lenofallgaps % maxlengap != 0:
		gaps.append(lenofallgaps % maxlengap)
	numofgaps = len(gaps)
	pos = 0
	j = 0
	for i in range(len(platforms)):
		if j < numofgaps:
			pos += gaps[j]
			j += 1
		for p in range(pos + 1, pos + platforms[i] + 1):
			river[p] = i + 1
		pos += platforms[i]
print('YES')
print(*river[1:-1])


from collections import defaultdict
import sys
input = sys.stdin.readline
(n, m, d) = map(int, input().split())
c = [int(i) for i in input().split()]
ind = defaultdict(int)
suff = n
for i in range(m - 1, -1, -1):
	suff -= c[i]
	ind[i + 1] = suff + 1
indl = []
for i in ind:
	indl.append(i)
indl.reverse()
cur = 0
for i in indl:
	if ind[i] - cur > d:
		ind[i] = cur + d
		cur += d
		cur += c[i - 1] - 1
	else:
		cur = ind[i] + c[i - 1] - 1
if n + 1 - cur > d:
	print('NO')
else:
	print('YES')
	ans = [0] * n
	for i in range(1, m + 1):
		for j in range(ind[i] - 1, min(n, ind[i] + c[i - 1] - 1)):
			ans[j] = i
	print(*ans)


def rsrch(k, x):
	for i in range(len(k) - 1, -1, -1):
		if k[i] == x:
			return i
	return -1
(n, m, d) = map(int, input().split())
pf = map(int, input().split())
trail = []
idx = 1
for i in pf:
	temp = [idx for x in range(i)]
	trail += temp
	idx += 1
idx = 1
x = 1
while len(trail) < n and x < d:
	trail = [0] + trail
	x += 1
while len(trail) < n and idx <= m:
	x = 1
	while x < d and len(trail) < n:
		trail.insert(rsrch(trail, idx) + 1, 0)
		x += 1
	idx += 1
if len(trail) == n and trail[-d:].count(0) != len(trail[-d:]):
	print('YES')
	print(*trail)
else:
	print('NO')


import sys
import os
from io import IOBase, BytesIO
import math
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read2DIntArray(row, col):
	arr = []
	for i in range(0, row):
		temp = list(map(int, sin().split()))
		arr.append(temp)
	return arr

def read2DCharArray(row, col):
	arr = []
	for i in range(0, row):
		temp = str(sin())
		arr.append(temp)
	return arr

def smallestNumber(n):
	lst = list(str(n))
	lst.sort()
	tmp = ''
	for (i, n) in enumerate(lst):
		if n != '0':
			tmp = lst.pop(i)
			break
	return str(tmp) + ''.join(lst)

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

def nCr(n, r):
	a = 1
	b = 1
	c = 1
	for i in range(1, n + 1):
		c *= i
	for i in range(1, r + 1):
		b *= i
	for i in range(1, n - r + 1):
		a *= i
	return c // (a * b)

def sieveOfEratosthenes1(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	s = [0] * (N + 1)
	sieveOfEratosthenes1(N, s)
	curr = s[N]
	cnt = 1
	factors = []
	power = []
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		factors.append(curr)
		power.append(cnt)
		curr = s[N]
		cnt = 1
	return (factors, power)

def main():
	(n, m, d) = map(int, sin().split())
	c = ain()
	summ = sum(c)
	tmp = c.copy()
	lst = []
	res = [0] * n
	pos = 0
	t = 0
	while pos < n + 1 and t < m:
		flag = 0
		for i in range(pos + 1, pos + d + 1):
			pos = i
			if pos + summ == n + 1:
				flag = 1
				break
		if flag == 0:
			for i in range(pos, pos + c[t]):
				res[i - 1] = t + 1
			pos += c[t] - 1
			summ -= c[t]
			t += 1
		else:
			for i in range(t, m):
				for j in range(pos, pos + c[i]):
					res[j - 1] = i + 1
				pos += c[i]
			break
	if pos + d < n + 1:
		print('NO')
	else:
		print('YES')
		print(*res)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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 input():
	return sys.stdin.readline().rstrip('\r\n')
main()


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
(n, m, d) = rl()
c = rl()
s = sum(c)
trous = n - s
if trous > (d - 1) * (m + 1):
	print('NO')
	exit()
else:
	count = 1
	ans = []
	while trous >= d - 1 and count <= m:
		ans += ['0'] * (d - 1)
		ans += [str(count)] * c[count - 1]
		count += 1
		trous -= d - 1
	ans += ['0'] * trous
	while count <= m:
		ans += [str(count)] * c[count - 1]
		count += 1
	print('YES')
	print(*ans)


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
ans = []
s = sum(c)
ind = []
j = -1
for i in range(len(c)):
	v = min(j + d, n - s)
	ind.append(v)
	j = v + c[i] - 1
	s -= c[i]
ans = []
if n - j > d:
	print('NO')
	exit()
i = 0
j = 0
v = 1
while i < n:
	if j < len(ind) and i == ind[j]:
		for l in range(c[j]):
			ans.append(v)
		v += 1
		i += c[j]
		j += 1
	else:
		i += 1
		ans.append(0)
print('YES')
print(*ans)


(n, m, d) = map(int, input().split())
lst = [*map(int, input().split())]
(res, s, x, item, i) = ([0] * n, sum(lst), 0, 1, 0)
while i < n:
	x += 1
	if x == d or s == n - i:
		if item <= m:
			y = lst[item - 1]
			for j in range(i, i + y):
				res[j] = item
			i += y
			s -= y
			item += 1
			x = 0
		else:
			from sys import exit
			print('NO')
			exit()
	else:
		i += 1
print('YES')
print(*res)


(n, m, d) = map(int, input().split())
lengths = list(map(int, input().split()))
poses = [n + 1] * (m + 1)
index = m - 1
while index >= 0:
	poses[index] = poses[index + 1] - lengths[index]
	index -= 1
cur = 0
ind = 0
result = True
while cur < n + 1:
	if cur + d >= n + 1:
		break
	if ind == m:
		result = False
		break
	if cur + d <= poses[ind]:
		poses[ind] = cur + d
		cur = cur + d + lengths[ind] - 1
		ind += 1
	else:
		cur = cur + d
if result:
	print('YES')
	poses.append(0)
	lengths.append(0)
	lengths.append(1)
	res = []
	for (ind, it) in enumerate(poses[:-1]):
		for _ in range(it - poses[ind - 1] - lengths[ind - 1]):
			res.append('0')
		for _ in range(lengths[ind]):
			res.append(str(ind + 1))
	print(' '.join(res))
else:
	print('NO')


(n, m, d) = map(int, input().split())
nums = list(map(int, input().split()))
sum_ = sum(nums)
if (m + 1) * (d - 1) + sum_ < n:
	print('NO')
else:
	print('YES')
	ans = []
	need_jump = n - sum_
	index = 1
	while need_jump:
		jump = min(need_jump, d - 1)
		ans += jump * [0]
		if index <= m:
			ans += [index] * nums[index - 1]
			index += 1
		need_jump -= jump
	while index <= m:
		ans += [index] * nums[index - 1]
		index += 1
	print(' '.join(map(str, ans)))


(n, m, d) = map(int, input().split())
array = list(map(int, input().split()))
ss = sum(array)
ans = [0] * (n + 1)
s = 0
for i in range(m):
	pos = min(s + d, n + 1 - ss)
	for j in range(pos, pos + array[i]):
		ans[j] = i + 1
	s = pos + array[i] - 1
	ss -= array[i]
if s + d <= n:
	print('NO')
else:
	print('YES')
	for i in range(1, n + 1):
		print(ans[i], end=' ')
	print('')


(width, num_plats, jump_dist) = map(int, input().split())
plat_sizes = list(map(int, input().split()))
min_gap = jump_dist - 1
total = min_gap
plat_total = 0
for i in range(len(plat_sizes)):
	total += plat_sizes[i]
	plat_total += plat_sizes[i]
	total += min_gap
if total >= width:
	print('YES')
else:
	print('NO')
	exit()
gaps_needed = width - plat_total
for i in range(len(plat_sizes)):
	for _ in range(min_gap):
		if gaps_needed > 0:
			print(0, end=' ')
		gaps_needed -= 1
	for _ in range(plat_sizes[i]):
		print(i + 1, end=' ')
if gaps_needed > 0:
	for _ in range(gaps_needed):
		print(0, end=' ')


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
sumc = 0
for elem in c:
	sumc += elem
if sumc + (m + 1) * (d - 1) < n:
	print('NO')
else:
	print('YES')
	ans = []
	x = n - sumc
	for i in range(m):
		if x > d - 1:
			for j in range(d - 1):
				ans.append(0)
			for j in range(c[i]):
				ans.append(i + 1)
			x -= d - 1
		elif x > 0:
			for j in range(x):
				ans.append(0)
			for j in range(c[i]):
				ans.append(i + 1)
			x = 0
		else:
			for j in range(c[i]):
				ans.append(i + 1)
	for j in range(x):
		ans.append(0)
	print(*ans)


import sys
(n, m, d) = list(map(int, input().split()))
c = list(map(int, input().split()))
cur = 0
for p in range(m):
	cur += d
	cur += c[p] - 1
if cur < n + 1 - d:
	print('NO')
	return
res = [0] * n
cur = n - 1
for p in range(m - 1, -1, -1):
	for j in range(c[p]):
		res[cur] = p + 1
		cur -= 1
cur = 0
while cur < n + 1:
	cur += d
	if cur >= n + 1:
		break
	if res[cur - 1] == 0:
		idx = -1
		for j in range(cur, len(res)):
			if res[j] != 0:
				idx = j
				break
		cnt = 1
		for j in range(idx + 1, len(res)):
			if res[j] == res[idx]:
				cnt += 1
		num = res[idx]
		for j in range(cnt):
			res[cur + j - 1] = num
			res[idx + j] = 0
	while cur < len(res) and res[cur] > 0:
		cur += 1
print('YES')
print(' '.join((str(x) for x in res)))


import sys
import math
from collections import defaultdict, Counter, 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')
for i in range(1):
	(n, m, d) = map(int, input().split())
	c = list(map(int, input().split()))
	cur = -1
	start = 0
	flag = 0
	l = []
	while cur < n:
		if start < m:
			l.append([start + 1, cur + d, cur + d + c[start]])
			cur = cur + d + c[start] - 1
			start += 1
		else:
			if cur + d < n:
				flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')
		ans = [0] * n
		if cur < n:
			for j in l:
				for k in range(j[1], j[2]):
					ans[k] = j[0]
		else:
			pre = [0] * m
			pre[-1] = c[-1]
			for j in range(m - 2, -1, -1):
				pre[j] = pre[j + 1] + c[j]
			for j in range(len(l)):
				if pre[j] + l[j][1] < n:
					for k in range(l[j][1], l[j][2]):
						ans[k] = l[j][0]
				else:
					start = m - 1
					for k in range(n - 1, n - pre[j] - 1, -1):
						if c[start] == 0:
							start -= 1
						ans[k] = start + 1
						c[start] -= 1
					break
		print(*ans)


from sys import stdin
input = stdin.readline
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as c, permutations as p
from math import factorial as f, ceil, gcd, sqrt, log
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
mt = lambda r: [list(mp()) for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)

def fibo_n(n):
	return ((1 + sqrt(5)) / 2) ** n / sqrt(5)
mod = 1000000007
for _ in range(1):
	(ln, pl, d) = mp()
	lp = dq(mp())
	k = sum(lp)
	rem = ln - k
	curp = 0
	i = 0
	v = []
	ans = 'YES'
	while i < ln:
		mn = min(rem, d - 1)
		while mn and i < ln:
			v.append(0)
			i += 1
			mn -= 1
			rem -= 1
		if i < ln:
			if lp:
				k = lp.popleft()
				inc = k
				curp += 1
				while k and i < ln:
					v.append(curp)
					k -= 1
					i += 1
			else:
				i = ln
				ans = 'NO'
				break
	print(ans)
	if ans == 'YES':
		print(*v)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

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 Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
(n, m, d) = ilele()
A = alele()
river = [0] * n
cur = n - 1
for i in range(m - 1, -1, -1):
	x = A[i]
	while x:
		river[cur] = i + 1
		cur -= 1
		x -= 1
start = -1
p = -1
while True:
	start += d
	if start >= n:
		break
	if river[start] != 0:
		break
	l = start + 1
	while l < n and river[l] == 0:
		l += 1
	if l == n:
		Y(0)
		exit(0)
	r = l
	v = river[l]
	while r < n and river[r] == v:
		river[r] = 0
		r += 1
	length = r - l
	for i in range(start, start + length):
		river[i] = v
	start = start + length - 1
Y(1)
print(*river)


(n, m, d) = map(int, input().split(' '))
c = list(map(int, input().split(' ')))
l = sum(c)
if (m + 1) * (d - 1) + l >= n:
	print('YES')
	ans = [0] * n
	i = 0
	p = 0
	while i < n:
		if l + i + d - 1 < n:
			i += d - 1
			while i < n and c[p] > 0:
				l -= 1
				c[p] -= 1
				ans[i] = p + 1
				i += 1
			p += 1
		else:
			break
	i += n - (l + i)
	while p < m:
		while c[p] > 0:
			c[p] -= 1
			ans[i] = p + 1
			i += 1
		p += 1
	print(' '.join(map(str, ans)))
else:
	print('NO')


import sys
(n, m, d) = list(map(int, sys.stdin.readline().strip().split()))
a = list(map(int, sys.stdin.readline().strip().split()))
op = [0] * n
x = 0
c = 1
xx = sum(a)
f = 0
for i in range(m):
	if x + d + a[c - 1] > n:
		x = n
		break
	for j in range(x + d - 1, x + d + a[c - 1] - 1):
		op[j] = c
	x = x + d + a[c - 1] - 1
	c += 1
if c <= m:
	xxx = sum(a[c - 1:])
	xx = n - 1
	while xxx:
		if op[xx] == 0:
			op.pop(xx)
			xxx -= 1
		xx -= 1
	for i in range(c - 1, m):
		while a[i]:
			op.append(i + 1)
			a[i] -= 1
x += d
if x > n:
	print('YES')
	print(' '.join(list(map(str, op))))
else:
	print('NO')


import sys
input = sys.stdin.readline
(n, m, d) = list(map(int, input().split()))
arr = list(map(int, input().split()))
tot = sum(arr)
res = [0] * n
gap = 1
ptr = 0
j = 0
bool1 = True
while j < n:
	if gap < d and n - (j + 1) >= tot:
		j += 1
		gap += 1
		continue
	elif ptr < m:
		for k in range(j, j + arr[ptr]):
			res[k] = ptr + 1
		gap = 1
		tot -= arr[ptr]
		j += arr[ptr]
		ptr += 1
	else:
		j += 1
		bool1 = False
if bool1 == False:
	print('NO')
else:
	print('YES')
	s = ''
	for i in res:
		s = s + str(i) + ' '
	s = s[:-1]
	print(s)


import sys
from collections import deque
from queue import PriorityQueue
import math
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
(n, m, d) = il()
a = il()
b = [0 for i in range(n)]
i = -1
sp = sum(a)
for j in range(m):
	i += min(d, n - i - sp)
	sp -= a[j]
	for k in range(i, min(i + a[j], n)):
		b[k] = j + 1
	i += a[j] - 1
	if i >= n:
		break
if i + d < n:
	print('NO')
else:
	print('YES')
	print(*b)


(n, m, d) = map(int, input().split())
plats = list(map(int, input().split()))
total = sum(plats)
answer = [0] * (n + 1)
if total + (d - 1) * (m + 1) < n:
	print('NO')
elif total + (d - 1) >= n:
	d = n + 1 - total
	i = 1
	j = d
	for pl in plats:
		while pl > 0:
			answer[j] = i
			j += 1
			pl -= 1
		i += 1
	print('YES')
	print(' '.join(list(map(str, answer[1:]))))
else:
	ends = d
	plat_sum = 0
	cnt = 1
	for i in range(m):
		if total - plat_sum >= n + 1 - (ends - 1):
			break
		for j in range(plats[i]):
			answer[ends + j] = cnt
		ends += plats[i] - 1
		plat_sum += plats[i]
		cnt += 1
		if n + 1 - (ends - 1) < total - plat_sum + d:
			ends = n + 1 - (total - plat_sum)
			break
		ends += d
	for k in range(i + 1, m):
		plat = plats[k]
		for j in range(plat):
			answer[ends + j] = cnt
		ends += plat
		cnt += 1
	print('YES')
	print(' '.join(list(map(str, answer[1:]))))


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
woodLeft = [0 for i in range(len(c))]
add = 0
for i in range(len(c) - 1, -1, -1):
	add += c[i]
	woodLeft[i] = add
pos = 0
output = [0 for i in range(n)]
for i in range(len(c)):
	pos = min(pos + d, n - woodLeft[i] + 1)
	output[pos - 1:pos - 1 + c[i]] = [i + 1 for _ in range(c[i])]
	pos += c[i] - 1
if pos + d >= n + 1:
	print('YES')
	print(*output)
else:
	print('NO')


data = list(map(int, input().split()))
c = list(map(int, input().split()))
csum = sum(c)
if data[2] == 0:
	print('NO')
elif csum + (data[2] - 1) * (data[1] + 1) >= data[0]:
	print('YES')
	empt = data[0] - csum
	allempt = 0
	sol = []
	for i in range(data[1]):
		if allempt < empt:
			for z in range(data[2] - 1):
				if allempt >= empt:
					break
				sol.append(0)
				allempt += 1
		for j in range(c[i]):
			sol.append(i + 1)
		q = data[0] - len(sol)
	if q != 0:
		for i in range(q):
			sol.append(0)
	print(*sol)
else:
	print('NO')


from math import ceil, sqrt, gcd

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

def si():
	return input()

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

def li():
	return list(mi())
(n, m, d) = mi()
a = li()
s = (m + 1) * d
s += sum(a)
s -= m
if n + 1 > s:
	print('NO')
else:
	print('YES')
	b = [0] * (n + 1)
	s = sum(a)
	pos = 0
	for i in range(m):
		if pos + d + s - 1 <= n:
			pos += d
		else:
			pos = n - s + 1
		for j in range(pos, pos + a[i]):
			b[j] = i + 1
		s -= a[i]
		pos += a[i] - 1
	print(*b[1:])


from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
mod = 10 ** 9 + 7
(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
c = sum(l)
cur = 0
extra = 0
ans = 0
i = 0
z = n + 1 - sum(l)
ans = []
posn = []
prev = z
for i in range(m):
	posn.append((prev, prev + l[i]))
	prev = prev + l[i]
i = 0
while cur < n + 1:
	flag = 0
	count = 0
	while count != d and cur < n + 1:
		if posn != []:
			if posn[0][0] == cur:
				flag = 1
				break
		count += 1
		cur += 1
	for j in range(count - 1):
		ans.append(0)
	if posn != []:
		for j in range(l[i]):
			ans.append(i + 1)
		cur += l[i] - 1
	elif cur < n + 1:
		print('NO')
		exit()
	else:
		break
	posn.pop(0)
	i += 1
print('YES')
print(*ans)


(n, m, d) = map(int, input().split())
p = list(map(int, input().split()))
positions = [0] * len(p)
positions[-1] = n + 1 - p[-1]
for i in reversed(range(len(p) - 1)):
	positions[i] = positions[i + 1] - p[i]

def feasible(p, positions, d):
	if positions[0] > d:
		return False
	for i in range(1, len(p)):
		if positions[i] - (positions[i - 1] + p[i - 1] - 1) > d:
			return False
	if n + 1 - (positions[-1] + p[-1] - 1) > d:
		return False
	return True
g = [0] * m
g[0] = d
for i in range(1, m):
	g[i] = g[i - 1] + p[i - 1] - 1 + d
i = 0
while not feasible(p, positions, d) and i < len(p):
	positions[i] = g[i]
	i += 1
if feasible(p, positions, d):
	print('YES')
	board = [0] * n
	for i in range(m):
		for j in range(p[i]):
			board[positions[i] - 1 + j] = i + 1
	for e in board:
		print(e, end=' ')
	print()
else:
	print('NO')


(n, m, d) = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = [0] * 1000000
start = -1
for i in range(0, len(c)):
	for j in range(start + d, c[i] + start + d):
		ans[j] = i + 1
	start = c[i] + start + d - 1
if start + d < n:
	print('NO')
else:
	print('YES')
	total = 1000000
	to_remove = set()
	for i in range(1000000 - 1, -1, -1):
		if ans[i] == 0 and total > n:
			to_remove.add(i)
			total -= 1
	ans_2 = []
	for i in range(0, 1000000):
		if i not in to_remove:
			ans_2.append(ans[i])
	print(*ans_2)


(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
a = n - sum(l)
res = [0] * n
if (m + 1) * (d - 1) >= a:
	print('YES')
	p = 0
	i = 0
	j = 1
	v = 0
	t = 0
	while t < n and v < m:
		if a - p >= d:
			i += d - 1
			t += d - 1
			p += d - 1
			for k in range(i, i + l[v]):
				res[k] = v + 1
				t += 1
			i += l[v]
			v += 1
		elif a - p < d:
			i += a - p
			t += a - p
			p = a
			for k in range(i, i + l[v]):
				res[k] = v + 1
				t += 1
			i += l[v]
			v += 1
	print(*res)
else:
	print('NO')


(n, m, d) = map(int, input().split())
arr = list(map(int, input().split()))
s = sum(arr)
if (n - s) / (m + 1) > d - 1:
	print('NO')
	exit()
post_sum = []
for i in arr:
	post_sum.append(s)
	s -= i
ans = []
d -= 1
s = n - sum(arr)
for i in range(m):
	if s >= d:
		ans += [0] * d + [i + 1] * arr[i]
		s -= d
	else:
		ans += [0] * s + [i + 1] * arr[i]
		s = 0
ans += [0] * s
print('YES')
print(*ans)


(n, m, d) = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
plat_len = sum(c)
total_space = min((len(c) + 1) * (d - 1), n - plat_len)
if total_space + plat_len < n:
	print('NO')
else:
	print('YES')
	platform = 1
	left = total_space
	ini_space = min(left, d - 1)
	for _i in range(ini_space):
		print(0, end=' ')
	left -= ini_space
	for el in c:
		for i in range(el):
			print(platform, end=' ')
		space = min(left, d - 1)
		for i in range(space):
			print(0, end=' ')
		left -= space
		platform += 1
	for _i in range(left):
		print(0, end=' ')
	print()


(n, m, d) = map(int, input().split())
(*p,) = map(int, input().split())
i = 0
l = []
c = 0
f = False
while True:
	t = i + d
	if t >= n + 1:
		f = True
		l += [0] * (n - t + d)
		break
	else:
		if c >= m:
			break
		l += (d - 1) * [0] + [c + 1] * p[c]
		i = t + p[c] - 1
		c += 1
if f == True:
	print('YES')
	if c < m:
		for i in range(c, m):
			l += [i + 1] * p[i]
	j = len(l) - 1
	while len(l) > n:
		if l[j] == 0:
			del l[j]
		else:
			j -= 1
	print(*l)
else:
	print('NO')


import sys

def readline():
	return input()

def rindex(list, start):
	i = start
	while i >= 0:
		if list[i] == 0:
			return i
		i = i - 1

def room(list):
	i = len(list) - 1
	while list[i] == 0:
		i = i - 1
		if i < 0:
			break
	return len(list) - i - 1

def fun(n, m, d, c):
	ans = [0] * n
	i = 0
	ci = 0
	while ci < m:
		i += d - 1
		start = len(ans) - 1
		while room(ans) < c[ci]:
			k = rindex(ans, start)
			for a in range(k, n - 1):
				ans[a] = ans[a + 1]
			ans[n - 1] = 0
			i = n - room(ans)
			start = start - 1
		if i + c[ci] > n:
			i = n - c[ci]
		for j in range(c[ci]):
			ans[i] = ci + 1
			i = i + 1
		ci = ci + 1
	if i + d >= n + 1:
		print('YES')
		print(' '.join((str(x) for x in ans)))
	else:
		print('NO')
q = 1
for i in range(q):
	v = list(map(int, readline().split(' ')))
	c = list(map(int, readline().split(' ')))
	ans = fun(v[0], v[1], v[2], c)


(n, m, d) = list(map(int, input().split()))
c = list(map(int, input().split()))
r = sum(c)
cur = 0
ci = 0
mmap = [0] * n
while cur < n + 1 and ci < len(c):
	pi = min(cur + d, n - r + 1)
	for j in range(pi, pi + c[ci]):
		mmap[j - 1] = ci + 1
	cur = pi + c[ci] - 1
	r -= c[ci]
	ci += 1
if cur + d >= n + 1:
	print('YES')
	print(' '.join(map(str, mmap)))
else:
	print('NO')


def main():
	(n, m, d) = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	remainingC = sum(c)
	output2Arr = []
	i = 0
	platformIdx = 0
	distanceLeft = n
	while platformIdx < m:
		blanks = 0
		while blanks < d - 1 and remainingC < distanceLeft:
			output2Arr.append(-1)
			blanks += 1
			distanceLeft -= 1
		for _ in range(c[platformIdx]):
			output2Arr.append(platformIdx)
			remainingC -= 1
			distanceLeft -= 1
		platformIdx += 1
	while len(output2Arr) < n:
		output2Arr.append(-1)
	for i in range(len(output2Arr)):
		output2Arr[i] += 1
	if len(output2Arr) > n:
		print('NO')
	else:
		lastGapLen = 0
		for i in range(n - 1, -1, -1):
			if output2Arr[i] == 0:
				lastGapLen += 1
			else:
				break
		if lastGapLen >= d:
			print('NO')
		else:
			print('YES')
			oneLineArrayPrint(output2Arr)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))
main()


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
sc = sum(c)
if sc + (len(c) + 1) * (d - 1) < n:
	print('NO')
else:
	print('YES')
	ko = n - sc
	for i in range(m):
		if ko != 0:
			if ko >= d - 1:
				print('0 ' * (d - 1), end='')
				ko -= d - 1
			else:
				print('0 ' * ko, end='')
				ko = 0
		print((str(i + 1) + ' ') * c[i], end='')
	print('0 ' * ko, end='')


import sys
[n, m, d] = map(int, input().split())
c = list(map(int, input().split()))
tot_combined_length = sum(c)
plats = []
start_ind = n - tot_combined_length
for _plat in c:
	plats.append((start_ind, _plat))
	start_ind += _plat
cur_plat_being_considered = 0
cur_pos = -1
_res_plats = []
while True:
	cur_pos += d
	if cur_pos >= n:
		break
	elif cur_plat_being_considered > m - 1:
		print('NO')
		sys.exit()
	(start_ind, length) = plats[cur_plat_being_considered]
	if cur_pos < start_ind:
		_res_plats.append((cur_pos, length))
		cur_pos += length - 1
		cur_plat_being_considered += 1
	else:
		while start_ind + length - 1 < cur_pos:
			cur_plat_being_considered += 1
			_res_plats.append((start_ind, length))
			(start_ind, length) = plats[cur_plat_being_considered]
		cur_pos = start_ind + length - 1
if len(_res_plats) == 0:
	_res_plats = plats
else:
	for i in range(cur_plat_being_considered, m):
		(start_ind, length) = plats[i]
		_res_plats.append((start_ind, length))
res = [0] * n
for (idx, (start_ind, length)) in enumerate(_res_plats):
	for i in range(start_ind, start_ind + length):
		res[i] = idx + 1
print('YES')
print(' '.join(map(str, res)))


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
sc = [0] * m
sc[-1] = c[-1]
for i in range(m - 2, -1, -1):
	sc[i] = sc[i + 1] + c[i]
riv = n
p = 0
ans = ''
end = 0
l = 0
for i in range(m):
	r = c[i]
	gap = n - sc[i] - p
	if gap < d:
		ans += '0 ' * gap
		l += gap
		p = p + gap
	else:
		ans += '0 ' * (d - 1)
		l += d - 1
		p = p + d - 1
	st = p
	ans += (str(i + 1) + ' ') * c[i]
	l += c[i]
	p = st + c[i]
ans += '0 ' * (n - l)
if n - p < d:
	print('YES')
	print(ans)
else:
	print('NO')


(n, m, d) = map(int, input().split())
A = [int(i) for i in input().split()]
s = sum(A)
if (n - s) / (m + 1) > d - 1:
	print('NO')
	exit()
ans = []
d -= 1
s = n - s
for i in range(m):
	if s >= d:
		ans += [0] * d + [i + 1] * A[i]
		s -= d
	else:
		ans += [0] * s + [i + 1] * A[i]
		s = 0
ans += [0] * s
print('YES')
print(*ans)


import sys
input = sys.stdin.readline
(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
su = sum(c)
Index = []
start = n - su + 1
for i in range(m):
	Index.append(start)
	start += c[i]
h = Index[0]
pos = 0
MP = 0
while MP < m:
	if pos + d >= Index[MP]:
		pos = Index[MP]
		pos += c[MP]
		MP += 1
	else:
		pos += d
		Index[MP] = pos
		pos += c[MP] - 1
		MP += 1
if pos + d >= n + 1:
	print('YES')
	ans = [0] * n
	for i in range(m):
		yy = Index[i]
		for j in range(yy - 1, yy + c[i] - 1):
			ans[j] = i + 1
	print(*ans)
else:
	print('NO')


def f(n, m, d, a):
	b = [0] * m
	pos = 0
	for i in range(m):
		b[i] = pos + d
		pos = pos + d + a[i] - 1
	if b[-1] + a[-1] - 1 + d < n + 1:
		print('NO')
		return []
	pos = n + 1
	c = [0] * n
	for i in range(m - 1, -1, -1):
		if b[i] + a[i] - 1 >= pos:
			b[i] = pos - a[i]
		pos = b[i]
		for j in range(b[i], b[i] + a[i]):
			c[j - 1] = i + 1
	print('YES')
	return c
(n, m, d) = map(int, input().strip().split())
l = list(map(int, input().strip().split()))
print(*f(n, m, d, l))


(n, m, d) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
w = sum(l)
if w + (m + 1) * (d - 1) < n:
	print('NO')
else:
	print('YES')
	l2 = []
	tojump = n - w
	temp = 0
	abc = 0
	while abc < n:
		i = 0
		while i < d - 1 and tojump > 0 and (abc < n):
			l2 += [0]
			i += 1
			abc += 1
			tojump -= 1
		if abc < n:
			for j in range(l[temp]):
				l2 += [temp + 1]
				abc += 1
			temp += 1
	for e in l2:
		print(e, end=' ')


import sys
from collections import deque
input = sys.stdin.readline
(n, m, d) = map(int, input().split())
a = deque(map(int, input().split()))
ans = [0] * (n + 1)
p = sum(a)
if p + (m + 1) * d - m <= n:
	print('NO')
else:
	print('YES')
	l = 0
	for i in range(m):
		if l + d + p - 1 <= n:
			l += d
		else:
			l += n - (l + p - 1)
		for j in range(l, l + a[i]):
			ans[j] = i + 1
			l = j
		p -= a[i]
	print(*ans[1:])


import sys
(n, m, d) = list(map(int, input().split()))
c = [int(x) for x in sys.stdin.readline().split(' ')]
if sum(c) + (len(c) + 1) * (d - 1) < n:
	print('NO')
else:
	print('YES')
	ans = []
	sf = [0 for i in range(len(c) + 1)]
	for i in range(1, len(c) + 1):
		sf[~i] = sf[~(i - 1)] + c[~(i - 1)]
	curr_index = 0
	ans = [0 for i in range(n)]
	for i in range(len(c)):
		maxi = curr_index
		for j in range(1, d):
			if n - curr_index - (j + c[i]) >= sf[i + 1] and maxi + c[i] <= n:
				maxi = max(maxi, curr_index + j)
			else:
				break
		curr_index = maxi + c[i]
		ans[maxi] = c[i]
	idx = 1
	i = 0
	while i < len(ans):
		if ans[i] != 0:
			j = i
			while j < len(ans) and j < i + c[idx - 1]:
				ans[j] = idx
				j += 1
			idx += 1
			i = j
		else:
			i += 1
	for a in ans:
		print(a, end=' ')


def mint():
	return int(input())

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

def solve():
	(n, m, d) = mints()
	a = list(mints())
	b = [0] * m
	p = 0
	for i in range(m):
		b[i] = p + d
		p = p + d + a[i] - 1
	if b[-1] + a[-1] - 1 + d < n + 1:
		print('NO')
		return
	p = n + 1
	c = [0] * n
	for i in range(m - 1, -1, -1):
		if b[i] + a[i] - 1 >= p:
			b[i] = p - a[i]
		p = b[i]
		for j in range(b[i], b[i] + a[i]):
			c[j - 1] = i + 1
	print('YES')
	print(*c)
solve()


(n, m, d) = list(map(int, input().strip().split(' ')))
c = list(map(int, input().strip().split(' ')))
res = []
for (i, ci) in enumerate(c):
	empty = n - len(res) - sum(c[i:])
	if empty >= d - 1:
		res.extend(['0'] * (d - 1))
	else:
		res.extend(['0'] * empty)
	res.extend([str(i + 1) for _ in range(ci)])
if n - len(res) < d:
	res.extend(['0'] * (n - len(res)))
	print('YES')
	print(' '.join(res))
else:
	print('NO')


from collections import deque
(n, m, d) = [int(x) for x in input().split()]
plank_length = [int(x) for x in input().split()]
sum_planks = sum(plank_length)
path = deque()
path.extend([0] * (n - sum_planks))
index = 1
for pl in plank_length:
	path.extend([index] * pl)
	index += 1
spacing = (len(plank_length) + 1) * (d - 1)
if n - sum_planks > spacing:
	print('NO')
else:
	current_pos = 0
	index = 1
	while current_pos < n + 1:
		if current_pos + d > n or path[current_pos + d - 1] != 0:
			break
		else:
			for i in range(plank_length[index - 1]):
				path.remove(index)
			for i in range(plank_length[index - 1]):
				path.insert(current_pos + d + i - 1, index)
			current_pos = current_pos + d + plank_length[index - 1] - 1
			index += 1
	print('YES')
	for k in path:
		print(k, end=' ')


def main():
	(n, m, d) = map(int, input().split())
	c = list(map(int, input().split()))
	s = sum(c)
	if (m + 1) * d + s - m < n + 1:
		print('NO')
		return
	a = [0] * n
	last = n
	k = m
	for i in c[::-1]:
		for j in range(last - i, last):
			a[j] = k
		k -= 1
		last -= i
	start = -1
	k = 0
	while True:
		if start + d < n and a[start + d] == 0:
			for i in range(n):
				if a[i] == k + 1:
					a[i] = 0
			for i in range(start + d, start + d + c[k]):
				a[i] = k + 1
			start = start + d + c[k] - 1
			k += 1
		else:
			break
	if start + d >= n or (start + d < n and a[start + d] > 0):
		print('YES')
		print(*a)
	else:
		print('NO')
	return
main()


import sys

def solve():
	(n,) = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	was = set()
	for value in range(1, n + 1):
		index = a.index(value)
		while index > 0 and a[index] < a[index - 1] and (index not in was):
			if index > 0 and a[index] < a[index - 1] and (index not in was):
				was.add(index)
				(a[index], a[index - 1]) = (a[index - 1], a[index])
			index -= 1
	print(*a)
(n, m, d) = map(int, sys.stdin.readline().split())
c = list(map(int, sys.stdin.readline().split()))
pos = [0] * m + [n + 1]
for i in range(m - 1, -1, -1):
	pos[i] = pos[i + 1] - c[i]
x = 0
i = 0
while x <= n - d:
	if i >= m:
		print('NO')
		sys.exit()
	if pos[i] > x + d:
		pos[i] = x + d
	x = pos[i] + c[i] - 1
	i += 1
res = [0] * (n + 1)
for i in range(m):
	for j in range(pos[i], pos[i] + c[i]):
		res[j] = i + 1
print('YES')
print(*res[1:])


a = input().split()
n = int(a[0])
m = int(a[1])
d = int(a[2])
mass = list(map(int, input().split()))
d1 = {}
d1[m - 1] = n + 1 - mass[m - 1]
for i in range(m - 2, -1, -1):
	d1[i] = d1[i + 1] - mass[i]
now = 0
nowpl = 0
flag = True
while True:
	if now + d >= d1[nowpl]:
		break
	d1[nowpl] = now + d
	now = now + d + mass[nowpl] - 1
	nowpl += 1
	if nowpl >= m:
		if now + d >= n + 1:
			break
		print('NO')
		flag = False
		break
if flag:
	print('YES')
	ret = ['0'] * n
	for i in range(m):
		for j in range(d1[i] - 1, d1[i] + mass[i] - 1):
			ret[j] = str(i + 1)
	print(' '.join(ret))


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
s = sum(c)
p = (m + 1) * (d - 1) + s
if p < n:
	print('NO')
else:
	print('YES')
	l = []
	(a, b) = (0, 0)
	y = n - s
	while b <= m:
		if a == 0:
			a += 1
			b += 1
			if y >= d - 1:
				for i in range(0, d - 1):
					l.append(0)
				y -= d - 1
			elif y < d - 1 and y > 0:
				for i in range(y):
					l.append(0)
				y = 0
		else:
			for i in range(0, c[b - 1]):
				l.append(str(b))
			a -= 1
	for i in l:
		print(i, end=' ')


(n, m, d) = map(int, input().split())
k = n
arr = list(map(int, input().split()))
arr2 = []
if (d - 1) * (m + 1) + sum(arr) < n or (sum(arr) < n and d == 1):
	print('NO')
elif d == 1 and sum(arr) == n:
	print('YES')
	arrrofl = []
	for t in range(len(arr)):
		arrrofl += arr[t] * [t + 1]
	for t in arrrofl:
		print(t, end=' ')
else:
	newarr = []
	for i in range(1, m + 1):
		newarr += [i] * arr[i - 1]
	newarr = [-1] + newarr + [m + 1]
	z = n - sum(arr)
	mini = 1
	he = z // (d - 1)
	for i in range(he):
		ind = newarr.index(mini)
		for t in range(d - 1):
			newarr.insert(ind, 0)
		mini += 1
	for t in range(z - he * (d - 1)):
		ind = newarr.index(mini)
		newarr.insert(ind, 0)
	newarr = newarr[1:len(newarr) - 1]
	print('YES')
	for t in newarr:
		print(t, end=' ')


import sys

def I():
	return sys.stdin.readline().rstrip()
(n, m, d) = map(int, I().split())
l = list(map(int, I().split()))
if (m + 1) * (d - 1) + sum(l) >= n:
	print('YES')
	td = n - sum(l)
	ans = []
	for (i, il) in enumerate(l):
		di = min(td, d - 1)
		td -= di
		ans.extend([0] * di)
		ans.extend([i + 1] * il)
	ans.extend([0] * td)
	print(*ans)
else:
	print('NO')


(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
final = [0] * n
s = sum(l)
dis = n - s
if dis > (d - 1) * (m + 1):
	print('NO')
else:
	print('YES')
	last = 0
	for i in range(m):
		x = min(dis, d - 1)
		dis -= x
		final[last + x:last + x + l[i]] = [i + 1] * l[i]
		last = last + x + l[i]
	print(*final)


(n, m, d) = list(map(int, input().split()))
c = [0] + list(map(int, input().split()))
op = [0] * n
loc = -1
rem = sum(c)
for i in range(1, m + 1):
	loc += min(d, n - loc - rem)
	rem -= c[i]
	for j in range(loc, min(loc + c[i], n)):
		op[j] = i
	loc += c[i] - 1
	if loc >= n:
		break
if loc + d < n:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, op)))


(n, m, d) = map(int, input().split())
arr = list(map(int, input().split()))
ss = sum(arr)
s = 0
ans = [0] * (n + 1)
for i in range(m):
	pro = min(s + d, n - ss + 1)
	for j in range(pro, pro + arr[i]):
		ans[j] = i + 1
	s = pro + arr[i] - 1
	ss -= arr[i]
if s + d <= n:
	print('NO')
	exit()
print('YES')
for i in range(1, n + 1):
	print(ans[i], end=' ')
print()


mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq
import random

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def listToString(s):
	str1 = ''
	for ele in s:
		str1 += ele
	return str1

def main():
	(n, m, d) = cin()
	a = ain()
	x = []
	xx = 0
	for i in a:
		xx += 1
		for j in range(i):
			x.append(xx)
		if len(x) > n:
			print('NO')
			sys.exit()
	k = n - len(x)
	y = []
	x = 0
	for i in a:
		x += 1
		for j in range(d - 1):
			if k == 0:
				break
			y.append(0)
			k -= 1
		for j in range(i):
			y.append(x)
	if k > d - 1:
		print('NO')
		sys.exit()
	for i in range(k):
		y.append(0)
	print('YES')
	print(*y)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


import heapq
from sys import stdin, stdout
from collections import defaultdict

def main():
	(n, m, d) = map(int, stdin.readline().split())
	c = [int(k) for k in input().split()]
	wood = 0
	for i in range(m):
		wood += c[i]
	freq = [0] * (n + 1)
	x = 0
	j = 0
	for i in range(1, n + 1):
		dis = x + d
		if j < m:
			w = c[j]
			add = dis - 1 + w
			if n - add >= wood - w:
				for k in range(dis, add + 1):
					freq[k] = j + 1
			else:
				rem = wood - w - (n - add)
				add = add - rem
				for k in range(add, add - w, -1):
					freq[k] = j + 1
			x = add
			wood -= w
			j += 1
		else:
			break
	if x + d >= n + 1:
		print('YES')
		print(*freq[1:n + 1])
	else:
		print('NO')
main()


(n, m, d) = [int(x) for x in input().split(' ')]
list1 = [int(x) for x in input().split(' ')]
x = (m + 1) * (d - 1) + sum(list1)
list2 = []
a = 0
b = 0
if x < n:
	print('NO')
else:
	print('YES')
	n0 = n - sum(list1)
	while b <= m:
		if a == 0:
			if n0 >= d - 1:
				list2.extend(['0'] * (d - 1))
				a += 1
				b += 1
				n0 -= d - 1
			elif 0 < n0 < d - 1:
				list2.extend(['0'] * n0)
				a += 1
				b += 1
				n0 = 0
			else:
				a += 1
				b += 1
		else:
			list2.extend([str(b)] * list1[b - 1])
			a -= 1
	print(' '.join(list2))


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
(n, m, d) = kk()
d -= 1
ls = ll()
su = sum(ls)
over = n - su
if su + (m + 1) * d < n:
	print('NO')
else:
	add = min(over, d)
	over -= add
	i = add
	arr = [0] * n
	for (ind, p) in enumerate(ls):
		for _ in range(p):
			arr[i] = ind + 1
			i += 1
		add = min(over, d)
		over -= add
		i += add
	print('YES')
	print(*arr)


(n, m, d) = map(int, input().split())
arr = list(map(int, input().split()))
if (m + 1) * (d - 1) >= n - sum(arr):
	print('YES')
	water = n - sum(arr)
	ans = []
	co = 0
	for i in arr:
		co += 1
		if water > d - 1:
			jump = d - 1
			water -= jump
		else:
			jump = water
			water = 0
		for j in range(jump):
			ans += [0]
		for j in range(i):
			ans += [co]
	for i in range(water):
		ans += [0]
	print(*ans)
else:
	print('NO')


(n, m, d) = map(int, input().split(' '))
C = list(map(int, input().split(' ')))
River = [0 for i in range(n + 2)]
River[0] = 1
River[-1] = 1
W = n - sum(C)
i = 0
for b in range(m):
	if W >= d - 1:
		i += d
		River[i:i + C[b]] = [b + 1 for j in range(C[b])]
		W -= d - 1
		i += C[b] - 1
	elif W > 0:
		i += W + 1
		River[i:i + C[b]] = [b + 1 for j in range(C[b])]
		W = 0
		i += C[b] - 1
	else:
		i += 1
		River[i:i + C[b]] = [b + 1 for j in range(C[b])]
		i += C[b] - 1
if W == 0 or W <= d - 1:
	print('YES')
	print(' '.join(map(str, River[1:-1])))
else:
	print('NO')


(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
if n > s + (m + 1) * (d - 1):
	print('NO')
else:
	print('YES')
	e = n - s
	if d == 1:
		l = []
		i = 1
		for j in a:
			l += [i] * j
			i += 1
		print(*l)
	else:
		q = e // (d - 1)
		r = e % (d - 1)
		l = []
		i = 1
		if r == 0 and q != 0:
			q -= 1
			r = d - 1
		for j in range(q):
			l += [0] * (d - 1)
			l += [i] * a[j]
			i += 1
		l += [0] * r
		for j in range(q, m):
			l += [i] * a[j]
			i += 1
		print(*l)


(n, m, d) = list(map(int, input().split()))
a = list(map(int, input().split()))
cur_pos = 0
pl_idx = 0
total = sum(a)
all_pl = False
if (d - 1) * (m + 1) + total < n:
	print('NO')
else:
	print('YES')
	counter = 0
	ans = []
	plidx = 0
	shift = 0
	idx = 0
	turn = 'j'
	while idx < n:
		if idx >= n - total and (not all_pl) and (turn == 'j'):
			all_pl = True
			turn = 'p'
			shift = 0
		if turn == 'j':
			ans.append(0)
		else:
			ans.append(plidx + 1)
		shift += 1
		idx += 1
		if turn == 'j' and shift == d - 1:
			turn = 'p'
			shift = 0
			counter += 1
		elif turn == 'p' and shift == a[plidx]:
			shift = 0
			if not all_pl:
				turn = 'j'
			plidx += 1
			total -= a[plidx - 1]
	print(*ans)


(n, m, d) = map(int, input().split())
platforms = list(map(int, input().split()))
river = [0 for i in range(n + 2)]
sum_len_platforms = sum(platforms)
max_len_gap = d - 1
sum_len_gaps = n - sum_len_platforms
max_num_gaps = m + 1
if sum_len_platforms + max_len_gap * max_num_gaps < n:
	print('NO')
	exit()
elif sum_len_gaps == 0:
	position = 0
	for i in range(len(platforms)):
		for p in range(position + 1, position + platforms[i] + 1):
			river[p] = i + 1
		position += platforms[i]
else:
	gaps = []
	c = sum_len_gaps // max_len_gap
	for _ in range(sum_len_gaps // max_len_gap):
		gaps.append(max_len_gap)
	if sum_len_gaps % max_len_gap != 0:
		gaps.append(sum_len_gaps % max_len_gap)
	num_gaps = len(gaps)
	position = 0
	j = 0
	for i in range(len(platforms)):
		if j < num_gaps:
			position += gaps[j]
			j += 1
		for p in range(position + 1, position + platforms[i] + 1):
			river[p] = i + 1
		position += platforms[i]
print('YES')
print(*river[1:-1])


from collections import defaultdict
(n, m, d) = map(int, input().split())
cs = list(map(int, input().split()))
sum_cs = sum(cs)
dist = sum_cs - len(cs) + d * (len(cs) + 1)
if dist <= n:
	print('NO')
else:
	answer = []
	jumps = n - sum_cs
	for (ind, c) in enumerate(cs):
		count_zero = d - 1
		jump = min(jumps, d - 1)
		jumps -= jump
		answer.extend([0] * jump)
		answer.extend([ind + 1] * c)
	if jumps:
		answer.extend([0] * jumps)
	print('YES')
	print(' '.join(map(str, answer)))


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
isc = []
e = n
for i in range(m - 1, -1, -1):
	s = e - c[i] + 1
	isc.append((i + 1, s, c[i]))
	e = s - 1
isc = isc[::-1]
cur_pos = 0
ans = [0] * n
for (i, s, c) in isc:
	if s - cur_pos > d:
		s = cur_pos + d
	for j in range(s, s + c):
		ans[j - 1] = i
	cur_pos = s + c - 1
if n + 1 - cur_pos > d:
	print('NO')
else:
	print('YES')
	print(*ans)


(n, m, d) = map(int, input().split())
b = [0] + list(map(int, input().split()))
s = sum(b)
ind = 1
ans = [0] * (n + 1)
i = 1
prev = 0
if s + len(b) * (d - 1) < n:
	print('NO')
	exit()
while i < n + 1:
	if s >= n + 1 - i:
		j = 0
		while j < b[ind]:
			ans[i] = ind
			prev = i
			i += 1
			j += 1
		s -= b[ind]
		ind += 1
	elif i - prev >= d:
		j = 0
		while j < b[ind]:
			ans[i] = ind
			prev = i
			i += 1
			j += 1
		s -= b[ind]
		ind += 1
	else:
		i += 1
print('YES')
print(*ans[1:])


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
(n, m, d) = rints()
c = rints()
sumc = sum(c)
if d == 1:
	if sumc < n:
		print('NO')
		exit(0)
	print('YES')
	for (i, ci) in enumerate(c):
		for _ in range(ci):
			print(i + 1, end=' ')
	print()
	exit(0)
water = n - sumc
if water / (d - 1) > m + 1:
	print('NO')
	exit(0)
print('YES')
for (i, ci) in enumerate(c):
	if water:
		for _ in range(min(water, d - 1)):
			print(0, end=' ')
		water -= min(water, d - 1)
	for _ in range(ci):
		print(i + 1, end=' ')
if water:
	for _ in range(water):
		print(0, end=' ')
print()


import math
import sys
from collections import defaultdict
from itertools import groupby
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	(n, m, d) = rt()
	c = rl()
	max_pos = []
	jump = d
	for ci in c:
		max_pos.append(jump)
		jump += ci - 1 + d
	if jump < n + 1:
		print('NO')
	else:
		if max_pos[-1] + c[-1] - 1 > n:
			max_pos[-1] = n - c[-1] + 1
			for i in range(m - 2, -1, -1):
				if max_pos[i] + c[i] - 1 >= max_pos[i + 1]:
					max_pos[i] = max_pos[i + 1] - c[i]
		print('YES')
		pos = 1
		for i in range(m):
			while pos < max_pos[i]:
				print('0 ', end='')
				pos += 1
			for j in range(c[i]):
				print(f'{i + 1} ', end='')
				pos += 1
		while pos <= n:
			print('0 ', end='')
			pos += 1
main()


(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
(s, k, c) = ([], 0, 0)
for i in range(m):
	c += l[i]
if c + (m + 1) * (d - 1) >= n:
	print('YES')
else:
	print('NO')
	exit()
c = n - c
t = d
for i in range(n):
	if c > 0 and t > 1:
		s.append(0)
		c -= 1
		t -= 1
	elif l[k] > 0:
		s.append(k + 1)
		l[k] -= 1
	if k < m and l[k] == 0:
		t = d
		k += 1
	if c == 0:
		break
while k < m:
	while l[k] > 0:
		s.append(k + 1)
		l[k] -= 1
	k += 1
print(*s)


(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l)
if n <= (m + 1) * (d - 1) + s:
	print('YES')
	s = n - s
	c = [0] * s + [i + 1 for i in range(m) for j in range(l[i])]
	i = -1
	p = 0
	flag = True
	while flag:
		if n <= i + d:
			break
		if c[i + d]:
			break
		c[s:s + l[p]] = [0] * l[p]
		c[i + d:i + d + l[p]] = [p + 1] * l[p]
		i += d + l[p] - 1
		s += l[p]
		p += 1
	print(*c, sep=' ')
else:
	print('NO')


import random

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

def get_int():
	return int(input())
(X, N, D) = get_many_ints()
planks = list(get_many_ints())
start = [D] * N
for i in range(1, N):
	start[i] = start[i - 1] + planks[i - 1] + D - 1
limit = X
for i in range(N - 1, -1, -1):
	if start[i] + planks[i] - 1 > limit:
		start[i] = limit - planks[i] + 1
	limit = start[i] - 1
if start[-1] + planks[-1] - 1 + D < X + 1:
	print('NO')
else:
	river = [0] * X
	for (i, (s, p)) in enumerate(zip(start, planks)):
		for j in range(s, s + p):
			river[j - 1] = i + 1
	print('YES')
	print(' '.join(map(str, river)))


data = input().split(' ')
(n, m, d) = (int(data[0]), int(data[1]), int(data[2]))
arr = list(map(int, input().split(' ')))
ans = [0] * (n + 1)
sum = 0
for i in arr:
	sum += i
nw = 0
for (idx, i) in enumerate(arr):
	if n + 1 - sum <= nw + d:
		for j in range(i):
			ans[n + 1 - sum + j] = idx + 1
		sum -= i
		nw = n + 1 - sum
	else:
		for j in range(i):
			ans[nw + d + j] = idx + 1
		sum -= i
		nw = nw + d + i - 1
if nw + d < n + 1:
	print('NO')
else:
	print('YES')
	print(*ans[1:])


(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
result = [0] * n
start = 0
ob = sum(a)
end = n - ob + 1
st = end - 1
for i in range(m):
	for j in range(st, st + a[i]):
		result[j] = i + 1
	st += a[i]
for i in range(m):
	if end - start > d:
		for j in range(end - 1, end + a[i] - 1):
			result[j] = 0
		ob -= a[i]
		end = n - ob + 1
		for j in range(start + d - 1, start + d + a[i] - 1):
			result[j] = i + 1
		start += d + a[i] - 1
	else:
		break
if end - start > d:
	print('NO')
else:
	print('YES')
	print(*result)


from sys import stdin, stdout
for i in stdin:
	(n, m, d) = list(map(int, i.strip().split()))
	break
for i in stdin:
	C = list(map(int, i.strip().split()))
	break
if sum(C) + (d - 1) * (m + 1) < n:
	stdout.write('NO\n')
else:
	stdout.write('YES\n')
	L = []
	k = n - sum(C)
	i = 1
	while k:
		L += [0 for j in range(min(k, d - 1))]
		if i != len(C) + 1:
			L += [i for j in range(C[i - 1])]
			i += 1
		k -= min(k, d - 1)
	while i <= len(C):
		L += [i for j in range(C[i - 1])]
		i += 1
	L = list(map(str, L))
	stdout.write(' '.join(L))


(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
tot = sum(a)
d -= 1
left = n
ans = []
cur = 1
if tot + (m + 1) * d < n:
	print('NO')
	exit()
for i in range(m):
	if left >= tot + d:
		ans += [0] * d + [cur] * a[i]
		left -= d + a[i]
		tot -= a[i]
		cur += 1
	else:
		g = max(0, left - tot)
		ans += [0] * g + [cur] * a[i]
		cur += 1
		left -= g + a[i]
		tot -= a[i]
if left <= d:
	ans += [0] * left
print('YES')
print(*ans)


def cross(n, m, d, c):
	if (m + 1) * (d - 1) + sum(c) < n:
		return 'NO'
	ans = []
	space = 1
	space_left = n - sum(c)
	c_count = 0
	while space_left:
		if space < d:
			ans.append('0')
			space += 1
			space_left -= 1
		else:
			ans.extend([c_count + 1 for i in range(c[c_count])])
			c_count += 1
			space = 1
	while c_count < m:
		ans.extend([c_count + 1 for i in range(c[c_count])])
		c_count += 1
	return ('YES', ' '.join([str(i) for i in ans]))
(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
res = cross(n, m, d, c)
if type(res) is tuple:
	print(res[0])
	print(res[1])
else:
	print(res)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

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

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

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
(n, m, d) = inpl()
c = inpl()
res = [0] * (n + 1)
idx = [[-1, -1] for _ in range(m)]
now = n
for i in range(m)[::-1]:
	idx[i][1] = now
	for x in range(c[i]):
		res[now] = i + 1
		now -= 1
	idx[i][0] = now + 1
now = 0
for i in range(m):
	nx = now + d
	if nx > n or res[nx]:
		break
	for j in range(idx[i][0], idx[i][1] + 1):
		res[j] = 0
	for j in range(nx, min(n - 1, nx + c[i])):
		res[j] = i + 1
		now = j
else:
	if now + d < n + 1:
		err('NO')
print('YES')
print(*res[1:])


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
s = sum(c)
a = []
r = n - s
g = r / (m + 1)
if g > d - 1:
	print('NO')
else:
	print('YES')
	for i in range(m):
		if r >= d - 1:
			a += [0] * (d - 1) + [i + 1] * c[i]
			r -= d - 1
		else:
			a += [0] * r + [i + 1] * c[i]
			r = 0
	a += [0] * r
	print(*a)


from sys import stdin
input = stdin.readline
(n, m, d) = map(int, input().split())
d -= 1
a = list(map(int, input().split()))
i = 1
ans = []
l = n - sum(a)
while l:
	t = [0] * min(l, d)
	l -= len(t)
	ans.extend(t)
	if a:
		ans.extend([i] * a.pop(0))
		i += 1
	elif l > 0:
		break
while a:
	ans.extend([i] * a.pop(0))
	i += 1
if len(ans) == n:
	print('YES')
	print(*ans)
else:
	print('NO')


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

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

def inp():
	return input()

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

def main():
	(n, m, d) = ints()
	c = lints()
	b = [0] * m
	p = 0
	for i in range(m):
		b[i] = p + d
		p = b[i] + c[i] - 1
	if b[-1] + c[-1] - 1 + d < n + 1:
		print('NO')
		return
	p = n + 1
	res = [0] * n
	for i in range(m - 1, -1, -1):
		if b[i] + c[i] - 1 >= p:
			b[i] = p - c[i]
		p = b[i]
		for j in range(b[i], b[i] + c[i]):
			res[j - 1] = i + 1
	print('YES')
	print(*res)
main()


(n, m, d) = map(int, input().split())
a = [int(o) for o in input().split()]
ans = [0] * n
j = 0
pi = -1
sa = sum(a)
cs = 0
flag = 0
i = 0
while i < n:
	if i - pi == d or sa - cs == n - i:
		if j >= m:
			flag = 1
			break
		k = 0
		while k < a[j]:
			ans[i] = j + 1
			i += 1
			k += 1
		cs += a[j]
		pi = i - 1
		j += 1
	else:
		i += 1
if flag == 0:
	print('YES')
	print(*ans)
else:
	print('NO')


a = list(map(int, input().split()))
c = list(map(int, input().split()))
n = a[0]
m = a[1]
d = a[2]
ans = [0 for i in range(n)]
pos = [0 for i in range(m)]
j = n - 1
for i in range(m):
	tmp = c[m - i - 1]
	while tmp > 0:
		tmp -= 1
		ans[j] = m - i
		pos[m - i - 1] = j
		j -= 1
x = -1
i = 0
flag = False
while x < n:
	tmp = x + d
	if tmp >= n or ans[tmp] != 0:
		flag = True
		break
	elif i < m:
		y = pos[i]
		for j in range(c[i]):
			ans[y + j] = 0
			ans[tmp + j] = i + 1
		x = tmp + c[i] - 1
		i += 1
	else:
		break
if flag:
	print('YES')
	for x in range(n):
		if x > 0:
			print(' ', end='')
		print(ans[x], end='')
	print()
else:
	print('NO')


(n, m, d) = map(int, input().split())
d -= 1
C = list(map(int, input().split()))
h = n - sum(C)
kek = []
for i in range(m):
	if h >= d:
		kek += [0] * d + [i + 1] * C[i]
		h -= d
	else:
		kek += [0] * h + [i + 1] * C[i]
		h = 0
if h > d:
	print('NO')
else:
	kek += [0] * h
	print('YES')
	print(*kek)


(n, m, d) = [int(c) for c in str(input()).split()]
x = [int(c) for c in str(input()).split()]
tab = []
somme = sum(x)
diff = n - somme
if d == 1 and somme < n:
	print('NO')
elif d == 1 and somme == n:
	print('YES')
	kkl = 1
	for kk in x:
		tab.extend([kkl] * kk)
		kkl += 1
	print(*tab)
elif diff // d <= m:
	j = 0
	h = 1
	while j < diff or h <= m:
		if j < diff:
			if tab != [] and tab[-1] == 0:
				print('NO')
				break
			if diff - j >= d - 1:
				tab.extend([0] * (d - 1))
			else:
				tab.extend([0] * (diff - j))
			j += d - 1
		if h <= m:
			tab.extend([h] * x[h - 1])
			h += 1
	else:
		print('YES')
		print(*tab)
else:
	print('NO')


import sys

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

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(n, m, d) = mints()
	a = list(mints())
	b = [0] * m
	s = sum(a)
	p = 0
	for i in range(m):
		b[i] = p + d
		p = p + d + a[i] - 1
	if b[-1] + a[-1] - 1 + d < n + 1:
		print('NO')
		return
	p = n + 1
	c = [0] * n
	for i in range(m - 1, -1, -1):
		if b[i] + a[i] - 1 >= p:
			b[i] = p - a[i]
		p = b[i]
		for j in range(b[i], b[i] + a[i]):
			c[j - 1] = i + 1
	print('YES')
	print(*c)
solve()


list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
b = 0
list3 = []
for j in range(list1[1]):
	for k in range(list2[j]):
		list3.append(j + 1)
if len(list3) < list1[0]:
	for m in range(list1[2] - 1):
		if len(list3) < list1[0]:
			list3.insert(m, 0)
if len(list3) < list1[0]:
	for j in range(list1[1]):
		b = list2[j] + b
		a = (list1[2] - 1) * (j + 1) + b
		if len(list3) < list1[0]:
			for m in range(list1[2] - 1):
				if len(list3) < list1[0]:
					list3.insert(a, 0)
if len(list3) < list1[0]:
	print('NO')
else:
	print('YES')
	print(*list3, sep=' ')


def solve(ls, n, d):
	arr = list(enumerate(ls, 1))
	s = sum(ls)
	count = n - s
	ans = []
	while count and arr:
		if count < d - 1:
			break
		ans.extend([0] * (d - 1))
		el = arr.pop(0)
		ans.extend([el[0]] * el[1])
		count -= d - 1
	if count > d - 1:
		return ('NO', [])
	ans.extend([0] * count)
	for item in arr:
		ans.extend([item[0]] * item[1])
	return ('YES', ans)
(n, _, d) = list(map(int, input().split()))
ls = list(map(int, input().split()))
(resp, ans) = solve(ls, n, d)
if ans:
	print(resp)
	print(' '.join(map(str, ans)))
else:
	print(resp)


import sys
(n, m, d) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a = []
i = 0
j = 0
while i + d < n + 1:
	if j >= len(c):
		print('NO')
		sys.exit()
	i += d + c[j] - 1
	a += [0] * (d - 1)
	a += [j + 1] * c[j]
	j += 1
s = 0
if len(a) > n:
	s += len(a) - n
elif len(a) < n:
	a += [0] * (n - len(a))
for i in range(j, m):
	s += c[i]
if s != 0:
	for i in range(n - 1, -1, -1):
		if a[i] == 0:
			s -= 1
			if s == 0:
				break
	f = i
	a = a[:f]
	try:
		j = max(a)
	except:
		j = 0
	while j < m:
		a += [j + 1] * c[j]
		j += 1
print('YES')
for i in a:
	print(i, end=' ')


def main():
	(n, m, d) = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	remainingC = sum(c)
	if n < remainingC:
		print('NO')
	else:
		ans0 = []
		remainingGap = n
		for (idx, x) in enumerate(c):
			n0s = min(remainingGap - remainingC, d - 1)
			ans0.append(n0s)
			remainingGap -= n0s
			ans0.append(idx)
			remainingGap -= x
			remainingC -= x
		lastn0 = remainingGap
		ans0.append(lastn0)
		if lastn0 > d - 1:
			print('NO')
		else:
			print('YES')
			ans1 = []
			for (i, x) in enumerate(ans0):
				if i % 2 == 0:
					for _ in range(x):
						ans1.append(0)
				else:
					for _ in range(c[x]):
						ans1.append(x + 1)
			oneLineArrayPrint(ans1)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))
main()


(n, m, d) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [0] * (m + 1)
b[-1] = n - sum(a)
for i in range(m):
	k = min(d - 1, b[-1])
	b[-1] -= k
	b[i] += k
if b[-1] >= d:
	print('NO')
	exit(0)
ans = []
for i in range(m):
	for j in range(b[i]):
		ans.append(0)
	for j in range(a[i]):
		ans.append(i + 1)
for j in range(b[-1]):
	ans.append(0)
print('YES')
print(*ans)


(n, m, d) = list(map(int, input().split()))
plank = list(map(int, input().split()))
summ = sum(plank)
j = 0
ans = [0] * n
curr = -1
i = 0
flag = 0
while i < n:
	if summ == n - i:
		if j == m:
			print('NO')
			flag = 1
			break
		for _ in range(plank[j]):
			ans[i] = j + 1
			i = i + 1
		summ = summ - plank[j]
		j = j + 1
		curr = i - 1
	elif i - curr == d:
		if j == m:
			flag = 1
			print('NO')
			break
		for _ in range(plank[j]):
			ans[i] = j + 1
			i = i + 1
		summ = summ - plank[j]
		j = j + 1
		curr = i - 1
	else:
		i = i + 1
if flag == 0:
	print('YES')
	print(*ans)


(n, m, d) = list(map(int, input().split()))
cs = list(map(int, input().split()))
ls = [0] * m
ls[m - 1] = cs[m - 1]
for i in range(m - 1):
	ls[m - i - 2] = ls[m - i - 1] + cs[m - i - 2]
if ls[0] + (d - 1) * (m + 1) < n:
	print('NO')
else:
	ns = [0] * n
	ci = 0
	jump = 1
	i = 0
	while i < n and ci < m:
		if ls[ci] < n - i:
			if jump < d:
				jump += 1
				ns[i] = 0
			else:
				for i in range(i, i + cs[ci]):
					ns[i] = ci + 1
					jump = 1
				ci += 1
		else:
			for i in range(i, i + cs[ci]):
				ns[i] = ci + 1
				jump = 1
			ci += 1
		i += 1
	print('YES')
	print(' '.join(list(map(str, ns))))


(n, m, d) = list(map(int, input().split(' ')))
numbers = list(map(int, input().split(' ')))
ans = ['0' for _ in range(n)]
j = 0
temp = 0
i = 0
while i < n and j < len(numbers):
	if sum(numbers[j:]) < n - i and temp != d - 1:
		temp += 1
		i += 1
	elif temp == d - 1 or sum(numbers[j:]) == n - i:
		for k in range(i, i + numbers[j]):
			ans[k] = str(j + 1)
		temp = 0
		i += numbers[j]
		j += 1
st = ans
temp = 0
for (k, i) in enumerate(st):
	if i != '0' or k == len(st) - 1:
		if i == '0':
			temp += 1
		if temp >= d:
			print('NO')
			break
		temp = 0
	else:
		temp += 1
else:
	print('YES')
	print(' '.join(ans))


def main():
	(n, m, d) = map(int, input().split())
	a = list(map(int, input().split()))
	add = sum(a)
	if add > n:
		print('NO')
		return
	else:
		i = 0
		j = 0
		ans = [0 for _ in range(n)]
		cnt = n - add
		while i < n and j < m:
			temp = d - 1
			i += min(cnt, temp)
			cnt -= min(cnt, temp)
			times = a[j]
			while times:
				ans[i] = j + 1
				i += 1
				times -= 1
			j += 1
		index = -1
		while index < n:
			if index + 1 >= n or ans[index + 1] >= 1:
				index += 1
			elif index + d >= n or ans[index + d] > 0:
				index += d
			else:
				break
		if index >= n:
			print('YES')
			for i in range(n):
				print(ans[i], end=' ')
		else:
			print('NO')
main()


(n, m, d) = map(int, input().split())
C = list(map(int, input().split()))
if d == 1:
	if sum(C) == n:
		print('YES')
		for (i, c) in enumerate(C):
			print('{} '.format(i + 1) * c, end='')
	else:
		print('NO')
else:
	gaps = n - sum(C)
	river = []
	ind = 0
	ans = True
	total = 0
	while total < n:
		gap = min(gaps, d - 1)
		gaps -= gap
		total += gap
		river.append((0, gap))
		if ind == len(C):
			break
		river.append((ind + 1, C[ind]))
		total += C[ind]
		ind += 1
	if total != n:
		ans = False
	if ans:
		print('YES')
		for (x, y) in river:
			print('{} '.format(x) * y, end='')
	else:
		print('NO')


line = input().split()
n = int(line[0])
m = int(line[1])
d = int(line[2])
line = input().split()
c = [int(x) for x in line]
if sum(c) + (len(c) + 1) * (d - 1) < n:
	print('NO')
else:
	cnt = n - sum(c)
	ans = []
	cnt2 = 0
	while cnt != 0:
		for i in range(d - 1):
			if cnt == 0:
				break
			ans.append(0)
			cnt -= 1
		if cnt2 >= len(c):
			break
		for i in range(c[cnt2]):
			ans.append(cnt2 + 1)
		cnt2 += 1
	while cnt2 != m:
		for i in range(c[cnt2]):
			ans.append(cnt2 + 1)
		cnt2 += 1
	print('YES')
	for ch in ans:
		print(str(ch), end=' ')
	print()


def ennd():
	print('NO')
	exit(0)

def add(res, step, inn):
	for i in range(step):
		res.append(inn)
(n, m, d) = map(int, input().split())
platform = [int(i) for i in input().split()]
shift = n
for item in platform:
	shift -= item
if d != 1:
	count = int(shift / (d - 1))
elif shift != 0:
	ennd()
else:
	count = 0
if shift > (m + 1) * (d - 1):
	ennd()
res = []
pos = 0
step = d - 1
while shift > 0 and pos < m:
	add(res, min(step, shift), 0)
	add(res, platform[pos], pos + 1)
	pos += 1
	shift -= step
for i in range(m):
	if pos > i:
		continue
	add(res, platform[i], i + 1)
for i in range(shift):
	res.append(0)
print('YES')
print(*res, sep=' ')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
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, m, d) = map(int, input().split())
arr = list(map(int, input().split()))
ss = sum(arr)
s = 0
ans = [0] * (n + 1)
for i in range(m):
	pro = min(s + d, n - ss + 1)
	for j in range(pro, pro + arr[i]):
		ans[j] = i + 1
	s = pro + arr[i] - 1
	ss -= arr[i]
if s + d <= n:
	print('NO')
	exit()
print('YES')
for i in range(1, n + 1):
	print(ans[i], end=' ')
print()


import sys
from itertools import accumulate

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
(N, M, d) = MAP()
A = LIST()
cur = 0
A2 = []
for a in A:
	cur += d
	A2.append((cur, cur + a))
	cur += a - 1
cur += d
A2.append((cur, cur + 1))
if cur < N + 1:
	NO()
	exit()
B = [0] * (M + 1)
for i in range(M, -1, -1):
	(l, r) = A2[i]
	if cur - (d - 1) >= N + 1:
		cur -= d - 1
		B[i] = d - 1
	else:
		dist = cur - (N + 1)
		cur -= dist
		B[i] = dist
		break
B = list(accumulate(B))
ans = [0] * N
for (i, (l, r)) in enumerate(A2[:-1]):
	l -= B[i]
	r -= B[i]
	for j in range(l - 1, r - 1):
		ans[j] = i + 1
YES()
print(*ans)


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')
from collections import deque
(n, m, d) = map(int, input().split())
vals = list(map(int, input().split()))
length = sum(vals)
if length <= n:
	riv = [deque([]) for s in range(n)]
	nxt = d - 1
	for s in range(m):
		plk = vals[s]
		if nxt + plk - 1 <= n - 1:
			for i in range(nxt, nxt + plk):
				riv[i].append(s)
			nxt += plk - 1 + d
		else:
			queue = deque([])
			cur = n - 1
			while (plk > 0 or len(queue) > 0) and cur >= 0:
				if plk > 0:
					riv[cur].append(s)
					plk -= 1
				else:
					riv[cur].append(queue.popleft())
				if len(riv[cur]) >= 2:
					queue.append(riv[cur].popleft())
				cur -= 1
	river = []
	for s in range(len(riv)):
		if len(riv[s]) == 0:
			river.append(0)
		else:
			river.append(riv[s].pop() + 1)
	if (m + 1) * (d - 1) >= n - length:
		print('YES')
		print(*river)
	else:
		print('NO')
else:
	print('NO')


(n, m, d) = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
d -= 1
res = []
h = n - sum(C)
for i in range(len(C)):
	if h >= d:
		res += [0] * d + [i + 1] * C[i]
		h -= d
	else:
		res += [0] * h + [i + 1] * C[i]
		h = 0
if h > d:
	print('NO')
else:
	print('YES')
	res += [0] * h
	print(*res)


def rfind(x, c):
	for i in range(len(x) - 1, -1, -1):
		if x[i] == c:
			return i
	return -1
(n, m, d) = [int(x) for x in input().split()]
plat = [int(p) for p in input().split()]
pattern = []
idx = 1
for i in plat:
	pattern += [idx for _ in range(i)]
	idx += 1
idx = 1
x = 1
while len(pattern) < n and x < d:
	pattern = [0] + pattern
	x += 1
while len(pattern) < n and idx <= m:
	x = 1
	while x < d and len(pattern) < n:
		pattern.insert(rfind(pattern, idx) + 1, 0)
		x += 1
	idx += 1
if len(pattern) == n and pattern[-d:].count(0) != len(pattern[-d:]):
	print('YES')
	print(*pattern)
else:
	print('NO')


li = []
list1 = [int(x) for x in input().split(' ')]
l = list1[0]
p = list1[1]
j = list1[2] - 1
platLengths = [int(x) for x in input().split(' ')]
if j * (p + 1) + sum(platLengths) >= l:
	print('YES')
	currentPlat = 1
	if j == 0:
		for i in range(currentPlat - 1, p):
			li += [currentPlat] * platLengths[i]
			currentPlat += 1
	else:
		jumpSpaces = l - sum(platLengths)
		numFullJumps = jumpSpaces // j
		leftOverJump = jumpSpaces % j
		numJumps = numFullJumps
		if leftOverJump > 0:
			numJumps += 1
		if numFullJumps >= p:
			for i in range(numFullJumps - (numFullJumps - p)):
				li += [0] * j
				li += [currentPlat] * platLengths[currentPlat - 1]
				currentPlat += 1
			li += [0] * (l - len(li))
		else:
			for i in range(numFullJumps):
				li += [0] * j
				li += [currentPlat] * platLengths[currentPlat - 1]
				currentPlat += 1
			li += [0] * leftOverJump
			for i in range(currentPlat - 1, p):
				li += [currentPlat] * platLengths[currentPlat - 1]
				currentPlat += 1
	print(*li)
else:
	print('NO')


import math

def main():
	line_1 = list(map(int, input().split()))
	line_2 = list(map(int, input().split()))
	width_of_river = line_1[0]
	number_of_platforms = line_1[1]
	max_jump = line_1[2] - 1
	platform_size_total = sum(line_2)
	max_length = max_jump * (number_of_platforms + 1) + platform_size_total
	if max_length >= width_of_river:
		total_jump_length_needed = width_of_river - platform_size_total
		if max_jump > 0:
			minimum_jumps_count = total_jump_length_needed // max_jump
			smallest_jump = total_jump_length_needed % max_jump
		else:
			minimum_jumps_count = 0
			smallest_jump = 0
		if smallest_jump != 0:
			minimum_jumps_count += 1
		result_list = []
		platform_counter = 0
		while minimum_jumps_count > 0:
			if minimum_jumps_count == 1 and smallest_jump != 0:
				jumping_size = [0] * smallest_jump
			else:
				jumping_size = [0] * max_jump
			result_list.extend(jumping_size)
			if platform_counter < number_of_platforms:
				platform_needed = [platform_counter + 1] * line_2[platform_counter]
				result_list.extend(platform_needed)
				platform_counter += 1
			minimum_jumps_count -= 1
		while platform_counter < number_of_platforms:
			platform_needed = [platform_counter + 1] * line_2[platform_counter]
			result_list.extend(platform_needed)
			platform_counter += 1
		result = ' '.join((str(number) for number in result_list))
		print('YES')
		print(result)
	else:
		print('NO')
main()


(n, m, d) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
(r, cur, ind, lst) = (sum(c), 0, 0, [0] * n)
while cur < n + 1 and ind < len(c):
	pi = min(cur + d, n - r + 1)
	for j in range(pi, pi + c[ind]):
		lst[j - 1] = ind + 1
	cur = pi + c[ind] - 1
	r -= c[ind]
	ind += 1
if cur + d >= n + 1:
	print('YES')
	print(' '.join(map(str, lst)))
else:
	print('NO')


(n, m, d) = map(int, input().split())
c = [int(x) for x in input().split()]
s = sum(c)
if (n - s) / (m + 1) > d - 1:
	print('NO')
else:
	print('YES')
	r = []
	cells = n - s
	for (i, p) in enumerate(c, start=1):
		gap = min(cells, d - 1)
		r.extend([0] * gap)
		cells -= gap
		r.extend([i] * p)
	r.extend([0] * cells)
	print(*r)