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$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Greedy algorithms


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()


from sys import stdin, stdout
A = stdin.readline().strip().split()
n = int(A[0])
m = int(A[1])
d = int(A[2])
c = list(map(int, stdin.readline().strip().split()))
gap = n - sum(c)
jumps = m + 1
if jumps * (d - 1) >= gap >= 0:
	res = []
	interval = int(gap / jumps)
	remainder = gap % jumps
	wi = 0
	for wi in range(m):
		cur = interval
		if remainder > 0:
			cur += 1
			remainder -= 1
		for j in range(cur):
			res.append(0)
		for j in range(c[wi]):
			res.append(wi + 1)
	for j in range(interval):
		res.append(0)
	print('YES')
	print(' '.join(map(str, res)))
else:
	print('NO')


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)


(n, m, d) = map(int, input().split())
arr = list(map(int, input().split()))
tmp = [0] * (d - 1)
ans = list()
for idx in range(m):
	tmp.extend([idx + 1] * arr[idx])
	tmp.extend([0] * (d - 1))
if len(tmp) < n:
	print('NO')
	exit()
clear_zeros = len(tmp) - n
for v in tmp:
	if v == 0 and clear_zeros > 0:
		clear_zeros -= 1
	else:
		ans.append(v)
print('YES')
print(*ans)


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) = map(int, input().split())
C = list(map(int, input().split()))
t = n - sum(C)
if t > (m + 1) * (d - 1):
	print('NO')
	exit()
(q, r) = divmod(t, m + 1)
cur = 0
ans = [0] * n
for i in range(m):
	if i <= r - 1:
		for j in range(cur + q + 1, cur + q + 1 + C[i]):
			ans[j] = i + 1
		cur += q + 1 + C[i]
	else:
		for j in range(cur + q, cur + q + C[i]):
			ans[j] = i + 1
		cur += q + C[i]
print('YES')
print(*ans)


(n, m, d) = list(map(int, input().split()))
c = list(map(int, input().split()))
arr = [0 for i in range(n + 2)]
index = 1

def count0(arr):
	counta = 0
	for i in range(n, -1, -1):
		if arr[i] == 0:
			counta += 1
		else:
			break
	return counta
for i in range(m):
	for j in range(c[i]):
		arr[index] = i + 1
		index += 1
count_index = 0
stop_index = 1
counta = count0(arr)
while d <= counta and count_index < m:
	ans = [0 for i in range(n + 2)]
	for i in range(stop_index, n + 1 - counta):
		ans[i + d - 1] = arr[i]
		arr[i] = 0
	for i in range(stop_index, n + 1):
		arr[i] = ans[i]
	stop_index += d - 1 + c[count_index]
	count_index += 1
	counta = count0(arr)
if count_index > m or counta >= d:
	print('NO')
else:
	print('YES')
	for i in range(1, n + 1):
		print(arr[i], end=' ')
	print('\n')


(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)


(width, n, d) = map(int, input().split())
lengths = map(int, input().split())
out = [[0, 1]]
i = 1
platform = 1
for length in lengths:
	out.append([i, length])
	i += length
success = 0
i = n
x = width + 1
while i >= 0:
	x -= d + out[i][1] - 1
	if x <= out[i][0]:
		success = 1
		break
	out[i][0] = x
	i -= 1
if success:
	result = [0] * width
	platform = 1
	for (start, length) in out[1:]:
		for i in range(start - 1, start - 1 + length):
			result[i] = platform
		platform += 1
	print('YES')
	print(' '.join(map(str, result)))
else:
	print('NO')


import sys
(n, m, d) = map(int, sys.stdin.readline().split())
tmp = [int(x) for x in sys.stdin.readline().split()]
sumDistance = n
for x in tmp:
	sumDistance -= x
q = n - sumDistance
if sumDistance % (m + 1) == 0:
	sumDistance //= m + 1
else:
	sumDistance //= m + 1
	sumDistance += 1
if sumDistance < d:
	print('YES')
	f = sys.stdout.write
	qq = 0
	if sumDistance != 0:
		qq = (n - q) // sumDistance
	o = 0
	for i in range(m):
		if i >= qq:
			sumDistance = 0
		o += sumDistance + tmp[i]
		f('0 ' * sumDistance + (str(i + 1) + ' ') * tmp[i])
	f('0 ' * (n - o))
else:
	print('NO')


(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')


def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
j = 0
p = m - 1
k = [0] * n
for i in range(n - 1, -1, -1):
	k[i] = p + 1
	j += 1
	if a[p] <= j:
		j = 0
		p -= 1
		if p == -1:
			break
z = 0
last = -1
for i in range(n):
	if k[i] == 1:
		last = i
	if i - last >= d and k[i] == 0:
		for j in range(0, n):
			if k[j] == z + 1:
				k[j] = 0
		for j in range(i, a[z] + i):
			k[j] = z + 1
			last = j
		z += 1
		if z == m and n - last > d:
			print('NO')
			exit(0)
if d > n:
	print('YES')
	print('1 ' * a[z] + '0 ' * (n - a[z]))
	exit(0)
print('YES')
print(*k)


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().strip().split())
cs = [int(i) for i in input().strip().split()]
river = [0 for i in range(n + 2)]
stand = 0
p_index = 0
out = False
while p_index < len(cs):
	if stand + d > n:
		p_index -= 1
		break
	for i in range(stand + d, stand + d + cs[p_index]):
		if i > n:
			out = True
			break
		river[i] = p_index + 1
		stand = i
	if out:
		p_index -= 1
		break
	p_index += 1
if stand + d <= n:
	print('no')
else:
	pops = [i for i in range(p_index + 1, len(cs))]
	a_index = n
	i = len(cs) - 1
	if p_index == -1:
		i = 0
		a = 1
		while i < len(cs):
			for j in range(a, a + cs[i]):
				river[j] = i + 1
			a += cs[i]
			i += 1
	else:
		need = False
		while pops != []:
			to_pop = pops.pop()
			for j in range(a_index, a_index - cs[to_pop], -1):
				if river[j] != 0 and river[j] != i + 1:
					if river[j] - 1 not in pops:
						pops = [river[j] - 1] + pops
				river[j] = to_pop + 1
			a_index -= cs[to_pop]
	print('yes')
	print(' '.join((str(i) for i in river[1:-1])))


import sys
input = sys.stdin.readline
(n, m, d) = map(int, input().split())
li = list(map(int, input().split()))
x = 0
l = 0
maxx = sum(li) + (d - 1) * (m + 1)
off = maxx - n
outlist = []
for i in range(m):
	if off >= d:
		off -= d - 1
	else:
		outlist.extend([0] * (d - off - 1))
		off = 0
	outlist.extend([i + 1] * li[i])
if off > d:
	off -= d - 1
else:
	outlist.extend([0] * (d - off - 1))
	off = 0
if maxx >= n:
	print('YES')
	print(' '.join([str(a) for a in outlist]))
else:
	print('NO')


[n, m, d] = [int(i) for i in input().split(' ')]
boards = [int(i) for i in input().split(' ')]
total = sum(boards)
gaps = n - total
if gaps > (m + 1) * (d - 1):
	print('NO')
else:
	print('YES')
	arr = []
	per = gaps // (m + 1)
	extra = gaps % (m + 1)
	curr = 0
	for i in range(m):
		toAdd = per
		if i < extra:
			toAdd += 1
		for j in range(toAdd):
			arr.append(0)
		for j in range(boards[i]):
			arr.append(i + 1)
	toAdd = per
	for j in range(toAdd):
		arr.append(0)
	print(' '.join([str(i) for i in arr]))


(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)


import sys
(n, m, d) = map(int, input().split())
d -= 1
mas = list(map(int, input().split()))
best = (n - sum(mas)) // (m + 1)
kol = (n - sum(mas)) % (m + 1)
now = best
if kol != 0:
	now += 1
if now > d:
	print('NO')
	sys.exit(0)
print('YES')
for i in range(m):
	if i < kol:
		print('0 ' * (1 + best), end='')
	else:
		print('0 ' * best, end='')
	print((str(i + 1) + ' ') * mas[i], end='')
print('0 ' * best)


def nextP(n, l, lastPos, posl):
	if n - lastPos == sum(l[posl:]) or n - (lastPos + d) < sum(l[posl + 1:]):
		return 0
	else:
		return d - 1

def find(n, m, d, l):
	river = [0 for i in range(n)]
	j = 0
	posl = 0
	z = 1
	posr = 0
	while posl < m:
		res = nextP(n, l, posr, posl)
		j = posr + res
		lim = j + l[posl]
		while j < lim:
			river[j] = z
			j += 1
		z += 1
		posr += res + l[posl]
		if posr >= n:
			break
		posl += 1
	if n - posr >= d:
		print('No')
	elif posr > n:
		print('No')
	else:
		print('Yes')
		for i in range(n):
			print(river[i], end=' ')
(n, m, d) = map(int, input().split())
l = [int(i) for i in input().split()]
find(n, m, d, l)


(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())
c = list(map(int, input().split()))
summ = sum(c)
water = n - summ
w_dis = (d - 1) * (m + 1)
if water > (d - 1) * (m + 1):
	print('NO')
	exit(0)
ans = [0] * n
it = 0
if n < d or water <= d - 1:
	for i in range(m):
		for _ in range(c[i]):
			ans[it] = i + 1
			it += 1
	print('YES')
	print(*ans)
	exit(0)
plat = 1
while water != w_dis:
	if w_dis - d + 1 >= water:
		m -= 1
		for _ in range(c[plat - 1]):
			ans[it] = plat
			it += 1
		plat += 1
		w_dis -= d - 1
	else:
		w_dis -= d - 1
		a = water % w_dis
		it += a
		water -= a
		for i in range(c[plat - 1]):
			ans[it] = plat
			it += 1
		plat += 1
		m -= 1
for _ in range(m):
	it += d - 1
	for i in range(c[plat - 1]):
		ans[it] = plat
		it += 1
	plat += 1
print('YES')
print(*ans)


(n, m, d) = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
tot = sum(c)
max = d - 1
for i in c:
	max += d - 1 + i
if max >= n:
	z = n - tot
	tz = int(z / (len(c) + 1))
	xc = z - (len(c) + 1) * tz
	seq = [0] * tz
	if xc > 0:
		seq += [0]
		xc -= 1
	for i in range(1, len(c) + 1):
		seq += [i] * c[i - 1]
		seq += [0] * tz
		if xc > 0:
			seq += [0]
			xc -= 1
	print('YES')
	print(' '.join([str(x) for x in seq]))
else:
	print('NO')


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
suffs = [0 for k in range(m + 1)]
for k in range(m - 1, -1, -1):
	suffs[k] = suffs[k + 1] + c[k]
(i, j) = (min(d - 1, n - 1), 0)
a = [0 for k in range(n)]
while i < n and j < m:
	if n - i < suffs[j]:
		poi = n - 1
		for x in range(m - 1, j - 1, -1):
			for k in range(c[x]):
				a[poi] = x + 1
				poi -= 1
		i = n
		break
	for k in range(i, i + c[j]):
		a[k] = j + 1
	i += c[j] - 1
	j += 1
	i = min(i + d, n)
if i >= n - (a[n - 1] != 0):
	print('YES')
	print(*a)
else:
	print('NO')


(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('')


(n, m, d) = map(int, input().split())
ar = list(map(int, input().split()))
ar.insert(0, 0)
ans = []
m += 1
i = 1
c = 0
while i < m:
	c += 1
	if c < d:
		ans.append('0')
	else:
		j = 0
		while j < ar[i]:
			ans.append(str(i))
			j += 1
		c = 0
		i += 1
i = 1
while i < d:
	ans.append('0')
	i += 1
if n <= len(ans):
	print('YES')
	c = len(ans)
	i = 0
	while i < len(ans):
		if ans[i] == '0' and c > n:
			c -= 1
		else:
			print(ans[i], end=' ')
		i += 1
	print()
else:
	print('NO')


(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=' ')


from sys import stdin
(n, m, d) = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.readline().split()]
sufsum = [0] * (m + 1)
for i in range(m - 1, -1, -1):
	sufsum[i] = sufsum[i + 1] + arr[i]
possible = False
(ptr, plank) = (0, 0)
while ptr < n + 1 and plank < m and (sufsum[plank + 1] < n - ptr):
	ptr += d
	ptr += arr[plank] - 1
	plank += 1
if ptr + d > n or (plank < m and sufsum[plank + 1] >= n - ptr):
	possible = True
if possible == False:
	print('NO')
else:
	print('YES')
	(pos, s) = (m - 1, 0)
	for i in range(m):
		s += d + arr[i] - 1
		if sufsum[i + 1] >= n - s:
			pos = i
			break
	ans = [0] * n
	ptr = 0
	for i in range(m):
		if i == pos:
			diff = n - sufsum[i + 1] - ptr
			if diff >= d - 1 + arr[i]:
				ptr += d - 1
			for j in range(arr[i]):
				if ptr >= n:
					break
				ans[ptr] = i + 1
				ptr += 1
			ptr = max(ptr, n - sufsum[i + 1] - 1)
			continue
		if i < pos:
			ptr += d - 1
		for j in range(arr[i]):
			if ptr >= n:
				break
			ans[ptr] = i + 1
			ptr += 1
	for i in ans:
		print(i, end=' ')


from itertools import accumulate
(n, m, dmax) = map(int, input().split())
c = list(map(int, input().split()))
if sum(c) - m + dmax * (m + 1) < n + 1:
	print('NO')
	exit()
else:
	print('YES')
d = (n - sum(c)) // (m + 1)
major_num = n - sum(c) - d * (m + 1)
ans = []
k = 1
for i in range(major_num):
	ans.extend([0] * (d + 1))
	ans.extend([k] * c[k - 1])
	k += 1
for i in range(m + 1 - major_num - 1):
	ans.extend([0] * d)
	ans.extend([k] * c[k - 1])
	k += 1
ans.extend([0] * d)
print(*ans)


(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)))


(n, m, d) = map(int, input().split())
riv = input().split()
d = d - 1
for i in range(m):
	riv[i] = int(riv[i])
s = 0
for i in range(m):
	s += riv[i]
if s + (m + 1) * d < n:
	print('no')
else:
	print('yes')
	res = [0] * n
	pas = (n - s) // (m + 1)
	nbplus = (n - s) % (m + 1)
	h = 0
	for j in range(m):
		if nbplus > 0:
			h += pas + 1
			nbplus -= 1
		else:
			h += pas
		b = riv[j]
		while b > 0:
			res[h] = j + 1
			h += 1
			b -= 1
	for i in range(n):
		print(res[i], end=' ')


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)


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
C = sum(c)

def builder(n, m, d, c, C):
	gap = d - 1
	ans = []
	for i in range(m):
		if n >= C + gap * (i + 1):
			for j in range(gap):
				ans.append(0)
			for j in range(c[i]):
				ans.append(i + 1)
		else:
			for j in range(c[i]):
				ans.append(i + 1)
	while len(ans) < n:
		ans.append(0)
	return ans

def checker(river, d):
	ans = 'YES'
	counter = 1
	trig = 0
	while trig == 0:
		if river[-counter] == 0:
			counter += 1
		else:
			trig = 1
	if counter - 1 > d - 1:
		ans = 'NO'
	return ans
river = builder(n, m, d, c, C)
ans = checker(river, d)
print(ans)
if ans == 'YES':
	for i in river:
		print(i, end=' ')


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)


(l, pNum, d) = [int(s) for s in input().split()]
P = [int(s) for s in input().split()]
rem = l
for p in P:
	rem -= p
if rem % (pNum + 1) == 0:
	inter = rem // (pNum + 1)
	if inter + 1 > d:
		print('NO')
	else:
		seq = '0 ' * inter
		ans = ''
		for i in range(pNum):
			ans += seq
			for j in range(P[i]):
				ans += str(i + 1) + ' '
		ans += seq
		print('YES')
		print(ans)
else:
	inter = rem // (pNum + 1) + 1
	if inter + 1 > d:
		print('NO')
	else:
		widers = rem % (pNum + 1)
		wider = '0 ' * inter
		closers = pNum + 1 - widers
		closer = '0 ' * (inter - 1)
		ans = ''
		for i in range(widers):
			ans += wider
			for j in range(P[i]):
				ans += str(i + 1) + ' '
		for i2 in range(closers - 1):
			ans += closer
			for j in range(P[widers + i2]):
				ans += str(widers + i2 + 1) + ' '
		ans += closer
		print('YES')
		print(ans)


def initial_setting(a, n, d):
	s = sum(a)
	t = n - s
	x = 0
	while d <= t:
		t -= 1
		x += 1
	return (t, x)
(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
if d == 1:
	if sum(a) == n:
		pos = [0] * len(a)
		pos[0] = 0
		for i in range(1, len(a)):
			pos[i] = a[i - 1] + pos[i - 1]
		dp = [0] * n
		s = 1
		for i in range(len(pos)):
			for j in range(pos[i], pos[i] + a[i]):
				dp[j] = s
			s += 1
		print('YES')
		print(*dp)
	else:
		print('NO')
else:
	(t, x) = initial_setting(a, n, d)
	pos = [0] * len(a)
	pos[0] = t
	for i in range(1, len(a)):
		pos[i] = a[i - 1] + pos[i - 1]
	req = x - min(x, d - 1)
	c = 0
	for p in range(1, len(pos)):
		if req <= d - 1:
			pos[p] = pos[p] + req + c
			c += req
			req = 0
		else:
			pos[p] = pos[p] + d - 1 + c
			req -= d - 1
			c += d - 1
	if req == 0:
		dp = [0] * n
		s = 1
		for i in range(len(pos)):
			for j in range(pos[i], pos[i] + a[i]):
				dp[j] = s
			s += 1
		print('YES')
		print(*dp)
	else:
		print('NO')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
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
from fractions import Fraction
mod = int(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)]
(n, m, d) = l()
c = l()
s = sum(c)
p = []
j = 0
for i in range(m):
	p.append(j)
	j += c[i]
k = n + 1
x = s
i = m - 1
while k - x > d and x > 0 and (i > -1):
	p[i] = k - d - c[i]
	x -= c[i]
	k = p[i] + 1
	i -= 1
if k > d and i == -1:
	print('NO')
else:
	ans = [0] * n
	j = 1
	for i in range(m):
		ans[p[i]:p[i] + c[i]] = [j] * c[i]
		j += 1
	print('YES')
	print(*ans)


def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problem1():
	q = inp(int)
	for _ in range(q):
		(a, b, n, S) = inp(int)
		S = S - min(S // n * n, a * n)
		if S <= b:
			print('YES')
		else:
			print('NO')

def problem2():
	q = inp(int)
	for _ in range(q):
		n = inp(int)
		a = inp(int, strip=False)
		start = 0
		while start < n - 1:
			(mn, pos) = (a[start], start)
			for i in range(start + 1, n):
				if a[i] < mn:
					mn = a[i]
					pos = i
			i = pos - 1
			while i >= start:
				(a[i], a[i + 1]) = (a[i + 1], a[i])
				i -= 1
			start = max(pos, start + 1)
		print(' '.join([str(el) for el in a]))

def problem3():
	(n, m, d) = inp(int)
	c = inp(int, strip=False)
	max_pos = 0
	for i in range(m):
		size = c[i]
		max_pos += size + d - 1
	max_pos += d
	if max_pos > n:
		print('YES')
		overshoot = max_pos - (n + 1)
		pos = 0
		res = [0 for _ in range(n + 1)]
		for i in range(m):
			size = c[i]
			if overshoot < d - 1:
				pos += d - 1 - overshoot
				overshoot = 0
			else:
				overshoot -= d - 1
			for j in range(pos + 1, pos + size + 1):
				res[j] = i + 1
			pos = pos + size
		print(' '.join([str(el) for el in res[1:]]))
	else:
		print('NO')

def problem4():
	pass
problem3()


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')


import sys
input = sys.stdin.readline

def main():
	(n, m, d) = [int(x) for x in input().split()]
	C = [int(x) for x in input().split()]
	current = -1
	ans = [0] * (1000 * 1000)
	for (i, c) in enumerate(C):
		current += d - 1
		for j in range(c):
			current += 1
			ans[current] = i + 1
	if current + d < n:
		print('NO')
	else:
		print('YES')
		amari = current - (n - 1)
		count = 0
		for a in ans:
			if a == 0 and amari > 0:
				amari -= 1
				continue
			count += 1
			print(a, end=' ')
			if count == n:
				break
		print('')
main()


import sys
[n, m, d] = [int(i) for i in sys.stdin.readline().split()]
c = [int(j) for j in sys.stdin.readline().split()]
tot = n - sum(c)
if tot // (m + 1) > d - 1:
	print('NO')
else:
	arr = [0] * (m + 1)
	for i in range(m + 1):
		arr[i] = tot // (m + 1)
	done = 1
	for j in range(tot % (m + 1)):
		arr[j] += 1
		if arr[j] > d - 1:
			done = 0
			break
	if done == 0:
		print('NO')
	else:
		ans = [0] * n
		last = 0
		for p in range(m):
			last = last + arr[p]
			ind = last
			for q in range(c[p]):
				ans[ind] = p + 1
				ind += 1
			last = last + c[p]
		print('YES')
		for h in range(n):
			print(ans[h], end=' ')
		print()


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:])


import sys
(n, m, d) = list(map(int, input().split()))
M = list(map(int, sys.stdin.readline().split()))
sumM = sum(M)
A = [0] * n
posit = -1
for platf in range(m):
	for ii in range(posit + min(d, n - sumM - posit), posit + min(d, n - sumM - posit) + M[platf]):
		A[ii] = platf + 1
	posit = ii
	sumM -= M[platf]
if n - posit > d:
	print('NO')
else:
	print('YES')
	print(*A)


(n, m, d) = map(int, input().split())
T = list(map(int, input().split()))
R = [0 for _ in range(n + 2)]
p = 0
cont = 1
while cont < m + 1:
	p += d
	ret = 0
	for i in range(p, p + T[cont - 1]):
		if i - ret > n + 1:
			ret += i - n - 1
		if i - ret > n:
			R.remove(0)
			ret += 1
			R.append(0)
		R[i - ret - 1] = cont
	p += T[cont - 1] - 1
	p -= ret
	cont += 1
p += d
if p < n + 1:
	print('No')
else:
	print('Yes')
	for i in range(n):
		print(R[i], end=' ')
	print()


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


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)


import math
(n, m, d) = map(int, input().split())
arr = map(int, input().split())
arr = list(arr)
if (n - sum(arr)) / (m + 1) > d - 1 or n < sum(arr):
	print('NO')
else:
	print('YES')
	ans = []
	for i in range(m):
		ans += [i + 1] * arr[i]
	zeroes = n - sum(arr)
	e = zeroes / (m + 1)
	f = 0
	if e % 1 != 0:
		f = 1 // (1 - e % 1)
	e = math.ceil(e)
	flag = 0
	if e > d:
		flag = 1
	ans = []
	i = 0
	k = 0
	while len(ans) < n:
		if i == m - 1:
			if zeroes > 0:
				ans += [0] * math.ceil(int(zeroes) / 2)
			ans += [i + 1] * arr[i]
			ans += [0] * math.floor(int(zeroes) / 2)
			zeroes = 0
		else:
			if zeroes > 0:
				if k == f - 1:
					ans += [0] * (math.ceil(e) - 1)
					zeroes -= math.ceil(e) - 1
					k = 0
				else:
					k += 1
					ans += [0] * math.ceil(e)
					zeroes -= math.ceil(e)
			ans += [i + 1] * arr[i]
			i += 1
	ans = map(str, ans)
	ans = list(ans)
	print(' '.join(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)


import sys

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

def slv():
	(n, m, d) = map(int, input().split())
	C = list(map(int, input().split()))
	if (d - 1) * (m + 1) < n - sum(C):
		print('NO')
		return
	print('YES')
	D = [d - 1] * (m + 1)
	rep = (d - 1) * (m + 1) - (n - sum(C))
	for i in range(rep):
		for j in range(m + 1):
			if D[j] > 0:
				D[j] -= 1
				break
	ans = []
	for i in range(m):
		for _ in range(D[i]):
			ans.append(0)
		for _ in range(C[i]):
			ans.append(i + 1)
	for _ in range(D[m]):
		ans.append(0)
	assert len(ans) == n
	print(*ans)
	return

def main():
	t = 1
	for i in range(t):
		slv()
	return
main()


import sys
readline = sys.stdin.readline
rdw = lambda : readline().rstrip()
rdws = lambda : readline().split()
rdwl = lambda : list(readline().split())
rdi = lambda : int(readline())
rdis = lambda : map(int, readline().split())
rdil = lambda : list(map(int, readline().split()))
rdilrows = lambda cnt: [rdil() for _ in range(cnt)]

def solve():
	(n, m, d) = rdis()
	c = rdil()
	total = sum(c)
	maxdif = (n - total + m) // (m + 1)
	if maxdif < d:
		dif = (n - total) // (m + 1)
		extra = (n - total) % (m + 1)
		res = ['0' for i in range(n)]
		i = dif
		if extra > 0:
			i += 1
			extra -= 1
		for (ci, cl) in enumerate(c):
			cnum = str(ci + 1)
			for j in range(cl):
				res[i + j] = cnum
			i += cl + dif
			if extra > 0:
				i += 1
				extra -= 1
		print('YES')
		print(' '.join(res))
	else:
		print('NO')
tests = 1
for testnum in range(tests):
	solve()


(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')


import math
(width, numofplanks, jump) = input().split(' ')
width = int(width)
numofplanks = int(numofplanks)
jump = int(jump)
planks = [int(planks) for planks in input().split(' ')]
tpl = sum(planks)
tjl = width - tpl
jumpleft = jump
distleft = width
manpos = 0
j = 0
k = 0
planksleft = numofplanks
a = [0 for i in range(width)]
if jump > width:
	for i in range(j, numofplanks):
		a[k:k + planks[i]] = [i + 1 for x in range(0, planks[i])]
		k += planks[i]
		print('yes')
		print(*a)
		break
elif jump <= width:
	for i in range(width):
		jumpleft -= 1
		if tjl == 0:
			for i in range(j, numofplanks):
				a[k:k + planks[i]] = [i + 1 for x in range(0, planks[i])]
				k += planks[i]
			print('yes')
			print(*a)
			break
		if jumpleft == 0:
			manpos += planks[j]
			distleft -= planks[j]
			jumpleft = jump
			a[k:k + planks[j]] = [j + 1 for i in range(0, planks[j])]
			k += planks[j]
			j += 1
			planksleft -= 1
		else:
			tjl -= 1
			manpos += 1
			distleft -= 1
			a[k] = 0
			k += 1
		if distleft < jumpleft:
			print('yes')
			a[k:width] = [0 for i in range(k, width)]
			k = width
			print(*a)
			break
		if planksleft == 0:
			if distleft < jump:
				print('yes')
				print(*a)
				break
			elif distleft >= jump:
				print('no')
				break


(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)


import random
from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
from collections import defaultdict, deque
import collections
(n, m, d) = list(map(int, input().split()))
C = list(map(int, input().split()))
bridge_len = sum(C)
water_len = n - bridge_len
min_water_len = floor(water_len / (m + 1))
max_water_len = ceil(water_len / (m + 1))
if max_water_len < d:
	print('YES')
	additional_water = water_len % (m + 1)
	ret = []
	for i in range(m):
		for j in range(min_water_len):
			ret.append(0)
		if additional_water > 0:
			ret.append(0)
			additional_water -= 1
		for j in range(C[i]):
			ret.append(i + 1)
	while len(ret) < n:
		ret.append(0)
	print(' '.join((str(i) for i in ret)))
else:
	print('NO')


def move(rightmost, d, seq, current):
	plankno = seq[rightmost]
	moving = rightmost
	rem = rightmost - current - d
	rightmost += 1
	for i in range(rem):
		temp = seq[moving]
		seq[moving] = seq[moving - 1]
		seq[moving - 1] = temp
		moving -= 1
	while rightmost != len(seq) and seq[rightmost] == plankno:
		seq[rightmost] = 0
		rightmost += 1
		seq[moving + 1] = plankno
		moving += 1
	return (moving, rightmost)
(n, m, d) = list(map(int, input().split()))
arr = [int(j) for j in input().split()]
planks = []
for i in range(m):
	planks += [i + 1] * arr[i]
rem = [0] * (n - len(planks))
seq = rem + planks
rightmost = n - 1
while seq[rightmost] != 0 and rightmost != -1:
	rightmost -= 1
rightmost += 1
current = -1
for i in range(m):
	if rightmost - current <= d:
		current = n - 1
		break
	else:
		(current, rightmost) = move(rightmost, d, seq, current)
if n - current > d:
	print('NO')
else:
	print('YES')
	print(*seq)


(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')


from math import ceil
(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
total_gap = n - sum(c)
dist_gap = total_gap / (m + 1)
if ceil(dist_gap) < d:
	print('YES')
	(a, b) = (ceil(dist_gap), ceil(dist_gap) - 1)
	no_a = (total_gap - (m + 1) * b) // (a - b)
	no_b = m + 1 - no_a
	res = []
	ci = 0
	while ci < m:
		if no_a:
			for i in range(a):
				res.append('0')
			no_a -= 1
		else:
			for i in range(b):
				res.append('0')
			no_b -= 1
		for i in range(c[ci]):
			res.append(str(ci + 1))
		ci += 1
	if no_a:
		for i in range(a):
			res.append('0')
		no_a -= 1
	else:
		for i in range(b):
			res.append('0')
		no_b -= 1
	print(' '.join(res))
else:
	print('NO')


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
boards = [None] * (m + 1)
boards[-1] = [n + 1, n + 1]
for i in range(m - 1, -1, -1):
	boards[i] = [boards[i + 1][0] - c[i], boards[i + 1][0] - 1]
pos = 0
for i in range(m + 1):
	if pos + 1 == boards[i][0]:
		pos = boards[i][1]
		continue
	if boards[i][0] <= pos + d <= n + 1:
		if pos + d <= boards[i][1]:
			pos = boards[i][1]
		continue
	diff = boards[i][0] - (pos + d)
	boards[i][0] -= diff
	boards[i][1] -= diff
	pos = boards[i][1]
if pos < n + 1:
	print('NO')
	return
else:
	ans = [0] * (n + 1)
	for i in range(m):
		for j in range(boards[i][0], boards[i][1] + 1):
			ans[j] = i + 1
	print('YES')
	print(*ans[1:])


(n, m, d) = tuple(map(int, input().split()))
c = list(map(int, input().split()))
if sum(c) + (m + 1) * (d - 1) >= n:
	print('YES')
	gaps = n - sum(c)
	compuls = gaps // (m + 1)
	adds = gaps % (m + 1)
	cover = [compuls] * (m + 1)
	for i in range(adds):
		cover[i] += 1
	counter = 1
	ans = []
	for i in range(m):
		ans.extend([0] * cover[i])
		ans.extend([counter] * c[i])
		counter += 1
	ans.extend([0] * cover[-1])
	print(*ans)
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) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
arr = [0] * n
temp = 0
for i in range(m):
	try:
		for j in range(c[i]):
			arr[temp] = i + 1
			temp += 1
	except:
		print('NO')
		quit()
q = 1
while n - temp > d - 1:
	try:
		temp_begin = arr.index(q)
		arr[temp_begin + d - 2:temp + d - 1] = arr[temp_begin:temp]
		arr[temp_begin:temp_begin + d - 2] = [0] * (d - 1)
		temp += d - 1
		q += 1
	except:
		print('NO')
		quit()
print('YES')
print(*arr)


import sys
input = sys.stdin.readline
(n, m, d) = map(int, input().split())
C = list(map(int, input().split()))
x = sum(C)
if -((n - x) // -(m + 1)) >= d:
	print('NO')
else:
	print('YES')
	y = (n - x) // (m + 1)
	z = n - x - y * (m + 1)
	ANS = [0] * n
	ind = 0
	for i in range(z):
		ind += y + 1
		for k in range(C[i]):
			ANS[ind] = i + 1
			ind += 1
	for i in range(z, m):
		ind += y
		for k in range(C[i]):
			ANS[ind] = i + 1
			ind += 1
	print(*ANS)


(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=' ')


(q, w, e) = map(int, input().split())
r = list(map(int, input().split()))
s = sum(r)
if s + (w + 1) * (e - 1) < q or q < s:
	print('NO')
	exit()
else:
	print('YES')
ans = [[0, 0]]
for i in range(w):
	ans.append([ans[-1][1] + 1, ans[-1][1] + r[i]])
ans.append([q + 1, q + 1])
i = -1
while i > -w - 1:
	if ans[i][0] - ans[i - 1][1] > e:
		ans[i - 1][0] += ans[i][0] - ans[i - 1][1] - e
		ans[i - 1][1] += ans[i][0] - ans[i - 1][1] - e
	else:
		break
	i -= 1
for i in range(w):
	for k in range(ans[i][1], ans[i + 1][0] - 1):
		print(0, end=' ')
	for k in range(ans[i + 1][0] - 1, ans[i + 1][1]):
		print(i + 1, end=' ')
for k in range(ans[i + 1][1], ans[i + 2][0] - 1):
	print(0, 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=' ')


from math import *
from collections import *
(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
suf = [0 for i in range(m)]
suf[-1] = a[-1]
for i in range(m - 2, -1, -1):
	suf[i] = suf[i + 1] + a[i]
l = [0 for i in range(n)]
prev = -1
for i in range(m):
	if n - (prev + d) >= suf[i]:
		st = prev + d
	else:
		st = prev + 1
	for j in range(st, st + a[i]):
		l[j] = i + 1
	prev = st + a[i] - 1
if prev + d < n:
	print('NO')
else:
	print('YES')
	for i in l:
		print(i, end=' ')
	print()


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()


(n, m, jump) = map(int, input().split())
a = list(map(int, input().split()))
total = 0
for i in range(m):
	total += a[i]
dist = n - total
b = dist // (m + 1)
visited = [b for i in range(n)]
if dist % (m + 1) > 0:
	b += 1
if b >= jump:
	print('NO')
else:
	for i in range(dist % (m + 1)):
		visited[i] += 1
	final = [0 for i in range(n)]
	i = 0
	count = 1
	j = 0
	while i < m:
		j += visited[i]
		for k in range(j, j + a[i]):
			final[k] = count
		j += a[i]
		count += 1
		i += 1
	print('YES')
	for i in range(n):
		print(final[i], end=' ')
	print()


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())
a = list(map(int, input().split()))
if not sum(a) + (m + 1) * (d - 1) >= n:
	print('NO')
else:
	print('YES')
	arr = [0] * (d - 1)
	for i in range(m):
		arr.extend([i + 1] * a[i])
		arr.extend([0] * (d - 1))
	final = []
	remove = len(arr) - n
	for x in arr:
		if remove and (not x):
			remove -= 1
		else:
			final.append(x)
	print(*final)


(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()))
i = 0
ans = [0] * n
flag = 0
t = 0
p = 0
s = sum(l)
i = i + d - 1
if s >= n - i:
	i = n - s
	t = 1
while i < n:
	if s >= n - i:
		i = n - s
		t = 1
	if t == 1:
		cur = l[p]
		while cur != 0:
			i += 1
			ans[i - 1] = p + 1
			cur -= 1
		s -= l[p]
		p += 1
	else:
		if s == 0 and i != n:
			flag = 1
			break
		cur = l[p]
		while cur != 0:
			i += 1
			ans[i - 1] = p + 1
			cur -= 1
		s = s - l[p]
		p += 1
		i = i + d - 1
if flag == 1:
	print('NO')
else:
	print('YES')
	print(*ans, sep=' ')


(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) = map(int, input().split())
(*c,) = map(int, input().split())
if (n - sum(c) + m) // d > m:
	print('NO')
else:
	print('YES')
	k = n - sum(c)
	for i in range(m):
		print('0 ' * (k // (m + 1) + (k % (m + 1) > i)), (str(i + 1) + ' ') * c[i])
	print('0 ' * (k // (m + 1)))


(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)))


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)

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

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

def inpl_str():
	return list(sys.stdin.readline().split())
(N, M, d) = inpl()
CC = inpl()
if sum(CC) + (d - 1) * (M + 1) < N:
	print('NO')
else:
	x = 0
	ans = [0] * (d - 1)
	i = 0
	for i in range(M):
		ans += [i + 1] * CC[i]
		ans += [0] * (d - 1)
	L = len(ans) - N
	ans2 = []
	for a in ans:
		if a == 0 and L > 0:
			L -= 1
		else:
			ans2.append(a)
	print('YES')
	print(' '.join(map(str, ans2)))


(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()


(river_width, n_platforms, jump_length) = [int(x) for x in input().split()]
platforms = [int(x) for x in input().split()]
river = [0] * river_width
position = -1
remaining = platforms.copy()
for (i, platform) in enumerate(platforms):
	np = position + jump_length
	while sum(remaining) + np > river_width:
		np -= 1
	for x in range(np, np + platform):
		river[x] = i + 1
	position = x
	remaining = remaining[1:]
found = False
for x in range(1, jump_length + 1):
	if river[-x] != 0:
		print('YES')
		print(*river)
		found = True
		break
if not found:
	print('NO')


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)


import sys
(n, m, d) = map(int, input().split())
line = list(map(int, input().split()))
if sum(line) + (d - 1) * (m + 1) < n:
	print('NO')
	sys.exit()
fill = []
for i in range(len(line)):
	fill += [0] * (d - 1) + [i + 1] * line[i]
fill += [0] * (d - 1)
ans = []
dell = len(fill) - n
for i in fill:
	if i == 0 and dell > 0:
		dell -= 1
	else:
		ans.append(i)
print('YES')
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:])


(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
l = [0] * (n * 2)
ci = d - 1
for i in range(m):
	l[ci:ci + a[i]] = [i + 1] * a[i]
	if ci >= n:
		for _ in range(ci - n + 1):
			l.remove(0)
		ci = n + a[i] - 1
	else:
		ci += a[i] - 1 + d
for i in range(ci - n):
	l.remove(0)
if ci < n:
	print('NO')
else:
	print('YES')
	print(*l[:n])


__version__ = '0.3'
__date__ = '2019-11-24'
import sys

def solve(n, m, d, c):
	empty_count = m + 1
	platform_area = sum(c)
	empty_area = n - platform_area
	max_step = empty_area // empty_count
	residue = empty_area % empty_count
	if max_step + 1 > d:
		return None
	elif residue > 0 and max_step + 2 > d:
		return None
	else:
		res = [0] * n
		curr = 0
		idx = 1
		while curr < n and idx <= m:
			curr += max_step
			if residue > 0:
				curr += 1
				residue -= 1
			res[curr:curr + c[idx - 1]] = [idx] * c[idx - 1]
			curr += c[idx - 1]
			idx += 1
		return res
	return None

def main(argv=None):
	(n, m, d) = map(int, input().split())
	c = list(map(int, input().split()))
	ans = solve(n, m, d, c)
	if not ans:
		print('NO')
	else:
		print('YES')
		print(' '.join(map(str, ans)))
	return 0
STATUS = main()
sys.exit(STATUS)


import sys
input = sys.stdin.buffer.readline
(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
ssum = [0] * (m + 1)
for i in range(m - 1, -1, -1):
	ssum[i] = c[i] + ssum[i + 1]
output = [0] * n
pos = 0
for i in range(m):
	if n - pos <= d - 1 + ssum[i]:
		for j in range(i, m):
			for k in range(c[j]):
				output[pos] = j + 1
				pos += 1
		break
	else:
		for j in range(pos + d, pos + d + c[i]):
			output[j - 1] = i + 1
		pos = pos + d + c[i] - 1
if pos + d >= n + 1:
	print('YES')
	print(*output)
else:
	print('NO')


(n, m, d) = map(int, input().split(' '))
y = list(map(int, input().split()))
s = sum(y)
if s + (m + 1) * (d - 1) >= n:
	arr = [0] * (n + 1)
	arr[0] = -1
	current = 1
	k = 1
	i = 0
	while i < m:
		j = 0
		while j < y[i]:
			arr[k] = current
			k += 1
			j += 1
		current += 1
		i += 1
	next1 = n + 1
	i = k - 1
	while i >= 0:
		if next1 - i > d:
			previous = arr[i]
			arr[i] = 0
			arr[next1 - d] = previous
			next1 = next1 - d
			if arr[i - 1] == previous:
				while arr[i - 1] == previous:
					previous = arr[i - 1]
					arr[i - 1] = 0
					arr[next1 - 1] = previous
					next1 = next1 - 1
					i -= 1
			i -= 1
		else:
			break
	print('YES')
	for i in range(1, n + 1):
		print(arr[i], end=' ')
else:
	print('NO')


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()


(n, m, d) = map(int, input().split())
c = [0] + list(map(int, input().split()))

def solve(c, d, n):
	max_l = 0
	for x in c:
		max_l += x + (d - 1)
	max_l += 1
	if max_l < n + 1:
		return ('NO', None)
	ans = [0] * n
	max_l -= d
	(div, re) = (0, 0)
	if max_l > n and d > 1:
		div = (max_l - n) // (d - 1)
		re = d - 1 - (max_l - n) % (d - 1)
		if re == d - 1:
			re = 0
	s = -1
	for (i, x) in enumerate(c[1:]):
		if div > 0:
			div -= 1
		elif re > 0:
			s += re
			re = 0
		else:
			s += d - 1
		for _ in range(x):
			s += 1
			ans[s] = i + 1
	return ('YES', ans)
(flg, ans) = solve(c, d, n)
if flg == 'NO':
	print(flg)
else:
	print(flg)
	print(' '.join([str(x) for x in ans]))


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())
c = list(map(int, input().split()))
if (m + 1) * (d - 1) + sum(c) < n:
	print('No')
else:
	print('Yes')
	N = n - sum(c)
	res = []
	dzero = [0 for _ in range(d - 1)]
	i = 0
	while N >= 0:
		if N >= d:
			res += dzero[:]
			res += [i + 1 for _ in range(c[i])]
			i += 1
			N -= d - 1
		else:
			res += [0 for _ in range(N)]
			break
	while i < len(c):
		res += [i + 1 for _ in range(c[i])]
		i += 1
	print(' '.join(map(str, res)))


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
nl = n
for i in c:
	nl -= i - 1
a = [0] * nl
no0 = nl - d
dr = m
pos = nl - (d - 1) - 1
while dr < pos + 1 and dr > 0:
	a[pos] = dr
	dr -= 1
	pos -= d
while dr > 0:
	a[dr - 1] = dr
	dr -= 1
pos1 = -1
for i in range(nl):
	if a[i] == 1:
		pos1 = i
if pos1 >= d:
	print('NO')
else:
	print('YES')
	for i in range(nl):
		if a[i] != 0:
			for j in range(c[a[i] - 1]):
				print(a[i], end=' ')
		else:
			print('0', end=' ')
	print()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
(river_width, n_platforms, jump_length) = [int(x) for x in input().split()]
platforms = [int(x) for x in input().split()]
river = [0] * river_width
position = -1
remaining = platforms.copy()
for (i, platform) in enumerate(platforms):
	np = position + jump_length
	while sum(remaining) + np > river_width:
		np -= 1
	for x in range(np, np + platform):
		river[x] = i + 1
	position = x
	remaining = remaining[1:]
found = False
for x in range(1, jump_length + 1):
	if river[-x] != 0:
		print('YES')
		print(*river)
		found = True
		break
if not found:
	print('NO')


(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')


(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
sum_c = sum(c)
tmp_ans = sum_c + (m + 1) * (d - 1)
if tmp_ans < n:
	print('NO')
	return
nokori = tmp_ans - n
ans = [0] * n
j = 1
for i in range(m):
	j -= 1
	if nokori >= d - 1:
		nokori -= d - 1
	else:
		j += d - 1 - nokori
		nokori = 0
	for _ in range(c[i]):
		ans[i + j] = i + 1
		j += 1
print('YES')
print(*ans)


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)))


def fill_arr(river, remaing_sum, cursor, size_ci, ind):
	return river
(n, m, d) = [*map(int, input().split())]
Ci = [*map(int, input().split())]
river = [0] * (n + 1)
cursor = 0
total_platform_size = sum(Ci)
used_platform = 0
bool_capasity = False
for (i, c) in enumerate(Ci):
	ind = i + 1
	if bool_capasity:
		d = c
	cursor += d
	used_platform += c
	remaining_platforms_size = total_platform_size - used_platform
	capasity = n - (cursor + c - 1)
	if capasity <= remaining_platforms_size:
		bool_capasity = True
		cursor = cursor + capasity - remaining_platforms_size
	river[cursor:cursor + c] = [ind] * c
	if c > 1:
		cursor = cursor + c - 1
river.pop(0)
if cursor + d > n:
	print('Yes')
	print(*river)
else:
	print('NO')


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))


import sys, math
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	(a, b, c) = map(int, input().split())
	return (a, b, c)
t = 1
for tt in range(t):
	(n, m, qw) = invr()
	c = inlt()
	n = n - sum(c)
	qw = qw - 1
	m = m + 1
	if m * qw >= n:
		print('YES')
		q = []
		for v in range(m):
			if v:
				q = q + [v] * c[v - 1]
			q = q + [0] * (n // m + (v < n % m))
		print(*q)
	else:
		print('NO')


(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')


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
(n, m, d) = map(int, input().split())
cs = list(map(int, input().split()))
maxAns = []
for (i, c) in enumerate(cs):
	maxAns.extend([0] * (d - 1))
	maxAns.extend([i + 1] * c)
maxAns.extend([0] * (d - 1))
if len(maxAns) < n:
	print('NO')
else:
	ctrDel = len(maxAns) - n
	ans = [0] * n
	i = j = 0
	while ctrDel > 0:
		if maxAns[j] == 0:
			ctrDel -= 1
			j += 1
		else:
			ans[i] = maxAns[j]
			i += 1
			j += 1
	while i < n:
		ans[i] = maxAns[j]
		i += 1
		j += 1
	print('YES')
	print(*ans)


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')


from sys import stdin
from collections import defaultdict
(n, m, d) = list(map(int, stdin.readline().split()))
marr = list(map(int, stdin.readline().split()))
if (m + 1) * (d - 1) + sum(marr) < n:
	print('NO')
else:
	print('YES')
	diff = (m + 1) * (d - 1) + sum(marr) - n
	gap = [d - 1] * (m + 1)
	i = 0
	while diff > 0 and i < len(gap):
		if gap[i] < diff:
			diff -= gap[i]
			gap[i] = 0
			i += 1
		else:
			gap[i] -= diff
			diff = 0
			break
	ans = []
	p = 0
	for i in range(len(gap)):
		for k in range(gap[i]):
			ans.append(0)
		if p < len(marr):
			for k in range(marr[p]):
				ans.append(p + 1)
			p += 1
	print(*ans)


(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()


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


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=' ')


(n, m, d) = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
l = [0] * n
tmp = 0
for i in range(len(c)):
	for x in range(c[i]):
		l[tmp] = i + 1
		tmp += 1
pos = n
tmp = m - 1
while True:
	if l[pos - d] == 0:
		g = pos - d - 1
		while l[g] == 0:
			g -= 1
		h = l[g]
		while l[pos - d] == 0:
			g += 1
			l[g] = h
			l[g - c[tmp]] = 0
		pos = g - c[tmp] + 1
		tmp -= 1
	else:
		break
	if tmp == -1:
		break
tmp = 0
while l[tmp] == 0:
	tmp += 1
if tmp >= d:
	print('NO')
else:
	print('YES')
	print(*l, sep=' ')


(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
s = sum(l)
ans = [0] * n
last = -1
ptr = 0
us = 0
for i in range(n):
	if s >= n - d - i + 1 and s > 0:
		last = i
		break
	if i - last >= d:
		if ptr >= m:
			print('NO')
			exit(0)
		if us != l[ptr]:
			ans[i] = ptr + 1
			us += 1
			s -= 1
		if us == l[ptr]:
			ptr += 1
			last = i
			us = 0
for i in range(ptr, m):
	for j in range(l[i]):
		ans[last] = i + 1
		last += 1
print('YES')
for i in ans:
	print(i, end=' ')


import sys
input = sys.stdin.readline
(N, M, D) = map(int, input().split())
C = list(map(int, input().split()))
L = sum(C) + (M + 1) * (D - 1)
if L < N:
	print('NO')
else:
	print('YES')
	rem = L - N
	water = []
	for i in range(M + 1):
		if rem >= D - 1:
			water.append(0)
			rem -= D - 1
		elif rem > 0:
			water.append(D - 1 - rem)
			rem = 0
		else:
			water.append(D - 1)
	ans = []
	for i in range(M):
		ans += [0] * water[i]
		ans += [i + 1] * C[i]
	ans += [0] * water[M]
	for a in ans:
		print(a, end=' ')
	print()


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)


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


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=' ')


(n, m, d) = map(int, input().split())
a = list(map(int, input().split()))
ans = [0] * n
start = d - 1
for i in range(m):
	if a[i] <= n - start:
		for j in range(a[i]):
			ans[start] = i + 1
			start += 1
		start += d - 1
	else:
		start -= d - 1
		for j in range(n):
			if a[i] > n - start:
				if ans[j] == 0:
					ans.pop(j)
					ans.append(0)
					start -= 1
		for j in range(a[i]):
			ans[start] = i + 1
			start += 1
		start += d - 1
if start >= n:
	print('YES')
	print(*ans, end=' ')
	print()
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)
	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))))


(a, b, c) = map(int, input().split())
d = list(map(int, input().split()))
g = []
if (c - 1) * (b + 1) + sum(d) >= a:
	print('YES')
	e = (a - sum(d)) // (b + 1)
	f = (a - sum(d)) % (b + 1)
	h = [1] * f + [0] * (b - f)
	for i in range(b):
		y = [0] * e
		g += y + [i + 1] * d[i] + [0] * h[i]
	g += y
else:
	print('NO')
for i in g:
	print(i, end=' ')


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


(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, math, queue, collections
MOD = 10 ** 9 + 7
(n, m, d) = map(int, input().split())
c = list(map(int, input().split()))
(a, ans) = ([], [])
x = 0
for ci in c:
	x += 1
	a += [0] * (d - 1)
	a += [x] * ci
a += [0] * (d - 1)
for i in range(len(a)):
	if a[i] != 0:
		ans.append(a[i])
	elif len(a) - i <= n - len(ans):
		ans.append(0)
if len(ans) == n:
	print('YES')
	print(*ans)
else:
	print('NO')


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')


import sys
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

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

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = 1
uu = t
while t > 0:
	t -= 1
	(n, m, k) = mi()
	a = li()
	d = [0] * n
	i = k - 1
	p = 0
	c = 1
	left = sum(a)
	while i < n:
		while i < n and a[p]:
			d[i] = c
			left -= 1
			a[p] -= 1
			i += 1
		if i == n or left == 0:
			break
		i += k - 1
		c += 1
		p += 1
	if left == 0:
		if n - i >= k:
			print('NO')
		else:
			print('YES')
			print(*d)
	else:
		print('Yes')
		i = 0
		while left:
			while i < n and a[p]:
				d.append(c)
				left -= 1
				a[p] -= 1
			c += 1
			p += 1
		p = len(d) - n
		r = []
		for i in range(len(d) - 1, -1, -1):
			if p == 0 or d[i]:
				r.append(d[i])
			else:
				p -= 1
		print(*r[::-1])


import sys
import math
(n, m, d) = map(int, sys.stdin.readline().split())
c = list(map(int, sys.stdin.readline().split()))
if math.ceil((n - sum(c)) / (m + 1)) < d:
	x = (n - sum(c)) // (m + 1)
	y = (n - sum(c)) % (m + 1)
	ans = [0 for _ in range(n)]
	ind = 1
	i = 0
	if y == 0:
		dis = x
	else:
		dis = x + 1
		y -= 1
	i = dis
	while i < n:
		j = 0
		while j < c[ind - 1] and i < n:
			ans[i] = ind
			j += 1
			i += 1
		ind += 1
		if y == 0:
			i += x
		else:
			i += x + 1
			y -= 1
	print('YES')
	print(' '.join((str(x) for x in ans)))
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)


(n, m, d) = list(map(int, input().split()))
c = list(map(int, input().split()))
if n > sum(c) + (m + 1) * (d - 1):
	print('NO')
else:
	ans = []
	S = sum(c)
	i = 1
	x = 0
	flag = True
	while flag and i <= m:
		if n - S < x + d:
			while i <= m:
				ans.append([i] * c[i - 1])
				i += 1
				flag = False
		else:
			ans.append([0] * (d - 1))
			ans.append([i] * c[i - 1])
			x += d + c[i - 1] - 1
			S -= c[i - 1]
			i += 1
	print('YES')
	answer = []
	i = 0
	while i < len(ans):
		for j in ans[i]:
			answer.append(j)
		i += 1
	for i in range(len(answer), n):
		answer.append(0)
	print(*answer)


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 sys
from sys import stdin
(n, m, d) = map(int, stdin.readline().split())
if m != 0:
	c = list(map(int, stdin.readline().split()))
ans = [0] * n
rem = sum(c)
last = -1
now = 0
for i in range(n):
	if i - last == d:
		if now >= m:
			print('NO')
			sys.exit()
		for j in range(i, i + c[now]):
			ans[j] = now + 1
		last = i + c[now] - 1
		rem -= c[now]
		now += 1
	elif now < m and i + rem == n:
		for j in range(i, i + c[now]):
			ans[j] = now + 1
		last = i + c[now] - 1
		rem -= c[now]
		now += 1
print('YES')
print(*ans)


import math
(n_river, n_platform, jump) = [int(i) for i in input().split()]
plat_length = [int(i) for i in input().split()]
empty = n_river + 1 - sum(plat_length)
avg_space = empty / (n_platform + 1)
if avg_space >= jump:
	print('NO')
	exit()
else:
	ans = []
	i = 1
	for plat in plat_length:
		avg_space = max(0, (n_river - len(ans) - sum(plat_length[i - 1:])) / (n_platform - i + 1))
		avg_space = math.ceil(avg_space)
		ans += [0] * min(jump - 1, avg_space)
		ans += [i] * plat
		i += 1
	if n_river - len(ans) >= jump:
		print('NO')
		exit()
	while len(ans) < n_river:
		ans.append(0)
	print('YES')
	for a in ans:
		print(a, end=' ')


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()


arr = [int(i) for i in filter(None, input().split(' '))]
s = arr[0]
k = arr[1]
mx = arr[2]
arr = [int(i) for i in filter(None, input().split(' '))]
sum = 0
for i in range(k):
	sum += arr[i]
sum += (mx - 1) * (k + 1)
if sum < s:
	wer = 'NO'
	print(wer)
else:
	wer = 'YES'
	ans = [0] * (mx - 1)
	for i in range(k):
		ans += [i + 1] * arr[i]
		ans += [0] * (mx - 1)
	max = len(ans)
	for i in range(len(ans)):
		if max <= s:
			break
		elif ans[i] == 0:
			ans[i] = -1
			max -= 1
	answer = []
	for i in range(len(ans)):
		if ans[i] != -1:
			answer.append(ans[i])
	print(wer)
	for i in range(len(answer)):
		print(answer[i], end=' ')


(n, m, d) = [int(i) for i in input().split()]
dd = [int(i) for i in input().split()]
ind = [0] * m
for i in range(1, m):
	ind[i] = ind[i - 1] + dd[i - 1]
end = n
for i in range(m - 1, -1, -1):
	lowind = end - dd[i] - d + 1
	if lowind <= ind[i]:
		break
	ind[i] = lowind
	end = lowind
if ind[0] >= d:
	print('NO')
else:
	print('YES')
	ans = []
	index = 0
	pind = 0
	while index < n:
		if pind < m and index == ind[pind]:
			k = dd[pind]
			pind += 1
			index += k
			ans += [pind] * k
		else:
			ans.append(0)
			index += 1
	print(*ans)


(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)