You are given a sequence of numbers a_1, a_2, ..., a_{n}, and a number m.

Check if it is possible to choose a non-empty subsequence a_{i}_{j} such that the sum of numbers in this subsequence is divisible by m.


-----Input-----

The first line contains two numbers, n and m (1 ≤ n ≤ 10^6, 2 ≤ m ≤ 10^3) — the size of the original sequence and the number such that sum should be divisible by it.

The second line contains n integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 10^9).


-----Output-----

In the single line print either "YES" (without the quotes) if there exists the sought subsequence, or "NO" (without the quotes), if such subsequence doesn't exist.


-----Examples-----
Input
3 5
1 2 3

Output
YES

Input
1 6
5

Output
NO

Input
4 6
3 1 1 3

Output
YES

Input
6 6
5 5 5 5 5 5

Output
YES



-----Note-----

In the first sample test you can choose numbers 2 and 3, the sum of which is divisible by 5.

In the second sample test the single non-empty subsequence of numbers is a single number 5. Number 5 is not divisible by 6, that is, the sought subsequence doesn't exist.

In the third sample test you need to choose two numbers 3 on the ends.

In the fourth sample test you can take the whole subsequence.

Source: codeforces | Difficulty: HARD
Tags: Dynamic programming

Data structures

Combinatorics

Amortized analysis


Solutions:
import unittest
import sys

class Modulo:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		[self.n, self.m] = map(int, uinput().split())
		self.nums = list(map(int, uinput().split()))
		self.modnums = [v % self.m for v in self.nums]
		self.cnt = {}
		self.vars = {}
		for v in self.modnums:
			if v not in self.cnt.keys():
				self.cnt[v] = 0
				self.vars[v] = set([])
			self.cnt[v] += 1

	def calculate(self):
		for v in self.vars.keys():
			cur = v
			for j in range(self.cnt[v]):
				if cur in self.vars[v]:
					break
				self.vars[v].add(cur)
				if cur == 0:
					return 'YES'
				cur = (cur + v) % self.m
		cur = set([0])
		for var in self.vars.keys():
			for s in set(cur):
				for v in self.vars[var]:
					res = v + s
					if res == self.m:
						return 'YES'
					cur.add(res % self.m)
		return 'NO'

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '3 5\n1 2 3 3'
		d = Modulo(test)
		self.assertEqual(d.n, 3)
		self.assertEqual(d.m, 5)
		self.assertEqual(d.nums, [1, 2, 3, 3])
		self.assertEqual(Modulo(test).calculate(), 'YES')
		test = '1 6\n5'
		self.assertEqual(Modulo(test).calculate(), 'NO')
		test = '4 6\n3 1 1 3'
		self.assertEqual(Modulo(test).calculate(), 'YES')
		test = '6 6\n5 5 5 5 5 5'
		self.assertEqual(Modulo(test).calculate(), 'YES')
		test = '4 5\n1 1 1 1'
		self.assertEqual(Modulo(test).calculate(), 'NO')
		self.time_limit_test(10000)

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(990) + '\n'
		nums = [random.randint(2, 990) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Modulo(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(Modulo().calculate())


def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	mods = set()
	flag = False
	for num in a:
		if mods:
			for j in mods.copy():
				mods.add((num + j) % m)
		mods.add(num % m)
		if 0 in mods:
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')
	return
main()


inp = input().split()
(n, m) = map(int, inp)
inp = input().split()
nums = list(map(int, inp))
mods = set()
for num in nums:
	newGen = {(num + mod) % m for mod in mods | {0}}
	mods |= newGen
	if 0 in mods:
		print('YES')
		exit()
print('NO')


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]

def check(a):
	possible = set()
	for num in a:
		to_add = set()
		for p in possible:
			new = p + num % k
			if new % k == 0:
				return 'YES'
			to_add.add(new % k)
		for t in to_add:
			possible.add(t)
		possible.add(num % k)
	if 0 in possible:
		return 'YES'
	return 'NO'
ans = check(a)
print(ans)


(n, m) = map(int, input().split())
if n > 2 * m:
	print('YES')
else:
	t = [0 for i in range(m)]
	s = input().split()
	for i in range(len(s)):
		h = int(s[i]) % m
		v = [0 for i in range(m)]
		for j in range(m):
			if t[j] == 1:
				v[(h + j) % m] = 1
		for j in range(m):
			if v[j] == 1:
				t[j] = 1
		t[h] = 1
	if t[0] == 1:
		print('YES')
	else:
		print('NO')


def main():
	(n, m) = map(int, input().split())
	mas = list(map(int, input().split()))
	remains = set()
	for i in range(n):
		for_add = set()
		for e in remains:
			if (e + mas[i]) % m == 0:
				return True
			else:
				for_add.add((e + mas[i]) % m)
		if mas[i] % m == 0:
			return True
		else:
			for_add.add(mas[i])
		remains |= for_add
if main():
	print('YES')
else:
	print('NO')


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

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

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

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

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, m) = mp()
l = li()
if n >= m:
	pr('YES')
else:
	for i in range(n):
		l[i] %= m
	dp = [[0 for i in range(m)] for j in range(n)]
	for i in range(n):
		dp[i][l[i]] = 1
	for i in range(1, n):
		for j in range(m):
			if dp[i][j]:
				continue
			dp[i][j] = dp[i - 1][j] | dp[i - 1][(j - l[i] + m) % m]
	pr('YES' if dp[-1][0] else 'NO')


(n, m) = map(int, input().split())
if n > m:
	print('YES')
else:
	a = [int(x) for x in input().split()]
	mod = set()
	for v in a:
		tmp = set()
		for i in mod:
			tmp.add((i + v) % m)
		tmp.add(v % m)
		mod |= tmp
	print('YES' if 0 in mod else 'NO')


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
r = set()
for i in A:
	i %= m
	rzo = set()
	for el in r:
		rzo.add((el + i) % m)
	for elem in rzo:
		r.add(elem)
	r.add(i)
	if 0 in r:
		print('YES')
		exit(0)
print('NO')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
if n > m:
	print('YES')
else:
	can = set()
	can.add(a[0] % m)
	newCan = set(can)
	for i in range(1, n):
		newCan.add(a[i] % m)
		for j in can:
			newCan.add((j + a[i]) % m)
		can = set(newCan)
	if 0 in can:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
import inspect, re

def varname(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bvarname\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		if m:
			return m.group(1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

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

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

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

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	k = [0 for i in range(m)]
	if m < n:
		print('YES')
		return
	dp = [[0 for i in range(m)] for j in range(n)]
	for i in range(n):
		dp[i][a[i] % m] = 1
	if dp[0][0]:
		print('YES')
		return
	for i in range(1, n):
		for j in range(m):
			if dp[i - 1][j]:
				dp[i][(a[i] + j) % m] = 1
				dp[i][j] = 1
		if dp[i][0]:
			print('YES')
			return
	print('NO')
	return
main()


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
pr = lambda x: x

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

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

def solve():
	(n, m) = aj()
	A = aj()
	if n > m:
		Y(1)
	else:
		dp = set([0])
		for i in A:
			temp = set()
			for j in dp:
				v = (j + i) % m
				if v == 0:
					Y(1)
					exit(0)
				if v not in dp:
					temp.add(v)
			dp = dp.union(temp)
		Y(0)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	from aj import *
except:
	pass
solve()


(n, m) = map(int, input().split())
l = [int(x) for x in input().split()]
if n > m:
	print('YES')
else:
	li = []
	f = 0
	for i in l:
		if i % m == 0 or i == 0:
			f = 1
		li.append(i % m)
	li.sort()
	cnt = [0] * m
	cnt[0] = 1
	for i in li:
		if f == 1:
			break
		tmp = [0] * m
		for j in range(m - 1, -1, -1):
			tmp[j] = tmp[j] + cnt[(j - i % m) % m]
		for j in range(0, m):
			cnt[j] = cnt[j] + tmp[j]
		if cnt[0] > 1:
			f = 1
	if f == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def fn(pos, rem, taken):
	if pos == n:
		return int(taken == 1 and rem == 0)
	if (pos, rem, taken) in dp:
		return dp[pos, rem, taken]
	dp[pos, rem, taken] = fn(pos + 1, rem, taken) or fn(pos + 1, (rem + a[pos]) % m, 1)
	return dp[pos, rem, taken]
for _ in range(1):
	(n, m) = list(map(int, stdin.readline().split()))
	a = list(map(int, stdin.readline().split()))
	if m <= n:
		print('YES')
		continue
	dp = {}
	if fn(0, 0, 0):
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
ans = set()
for i in map(int, input().split()):
	if ans:
		for j in ans.copy():
			ans.add((i + j) % m)
			ans.add(i % m)
	else:
		ans.add(i % m)
	if 0 in ans:
		print('YES')
		exit()
print('NO')


(n, m) = [int(i) for i in input().split(' ')]
arr = [int(i) % m for i in input().split(' ')]
c = {}
for i in range(m):
	c[i] = False
stack = [0]
newstack = []
for i in arr:
	for j in stack:
		arrrrgh = (i + j) % m
		if arrrrgh == 0:
			print('YES')
			return
		elif c[arrrrgh] == False:
			newstack.append(arrrrgh)
			c[arrrrgh] = True
	stack = stack + newstack
	newstack = []
print('NO')


from collections import defaultdict
from sys import stdin

def main():
	(n, k) = map(int, stdin.readline().split())
	st = set()
	for ar in map(int, stdin.readline().split()):
		nst = set()
		ar %= k
		nst.add(ar)
		for p in st:
			nst.add((p + ar) % k)
			nst.add(p)
		st = nst
		if 0 in st:
			print('YES')
			return
	print('No')
main()


(n, m) = map(int, input().split())
a = [int(i) % m for i in input().split()]
if n <= m:
	store = set()
	x = 0
	for i in a:
		b = set()
		if i == 0:
			x = 1
			break
		if i not in b:
			b.add(i)
		for j in store:
			if (i + j) % m == 0:
				x = 1
				break
			if (i + j) % m not in store:
				b.add((i + j) % m)
		if x == 1:
			break
		for j in b:
			store.add(j)
	if x == 1:
		print('YES')
	else:
		print('NO')
else:
	print('YES')


(n, m) = map(int, input().split())
a = set()
for i in map(int, input().split()):
	b = set()
	b = {(i + j) % m for j in a}
	a |= b
	a.add(i % m)
	if 0 in a:
		print('YES')
		exit()
print('NO')


import itertools as it
import functools
import operator
import collections
import math
import sys

def solve(xs, m):
	modulos = set()
	for x in xs:
		modulos |= {(x + i) % m for i in modulos}
		modulos.add(x % m)
		if 0 in modulos:
			return True
	else:
		return False

def tf_to_yn(tf):
	return 'YES' if tf else 'NO'

def print_stderr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def main():
	[n, m] = [int(i) for i in input().strip().split()]
	xs = [int(i) for i in input().strip().split()]
	assert len(xs) == n
	result = solve(xs, m)
	print(tf_to_yn(result))

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
s = set()
for i in l:
	c = {(i + j) % m for j in s}
	s = s | c
	s.add(i % m)
	if 0 in s:
		print('YES')
		exit()
print('NO')


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n, m) = I()
a = I()
s = set()
ans = 'NO'
for i in a:
	cur = {(i + j) % m for j in s}
	s |= cur
	s.add(i % m)
	if 0 in s:
		ans = 'YES'
		break
print(ans)


import sys
(N, M) = input().split()
A = list(map(int, input().split()))
N = int(N)
M = int(M)
if N > M:
	print('YES')
	return
sys.setrecursionlimit(2000)
Q_memo = {}
for (i, a) in enumerate(A):
	A[i] = A[i] % M

def Q(i, K, empty_sequence_ok):
	if empty_sequence_ok and K == 0:
		return True
	if i == 0:
		return A[0] == K
	args = (i, K, empty_sequence_ok)
	if args not in Q_memo:
		Q_memo[args] = Q(i - 1, K, empty_sequence_ok) or Q(i - 1, (K - A[i]) % M, True)
	return Q_memo[args]
if Q(N - 1, 0, False):
	print('YES')
else:
	print('NO')


(n, m) = map(int, input().split())
a = list(map(lambda x: x % m, map(int, input().split())))
h = {}
for el in a:
	h[el] = h.get(el, 0) + 1
for v in h.values():
	if v % m == 0:
		print('YES')
		exit()
possible = set([])
for el in a:
	new = set([el])
	for candidate in possible:
		new.add((candidate + el) % m)
	possible |= new
	if 0 in possible:
		print('YES')
		exit()
print('NO')


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
(n, m) = nm()
a = nl()
te = set()
tt = []
f = 1
for i in a:
	for j in te:
		q = (j + i) % m
		tt.append(q)
	tt.append(i % m)
	if 0 in tt:
		f = 0
		break
	while len(tt) > 0:
		q = tt.pop()
		te.add(q)
if f == 0:
	print('YES')
else:
	print('NO')


__author__ = 'User'
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
for i in range(n):
	arr[i] = arr[i] % m
d = [0] * m
for e in arr:
	t = [0] * m
	t[e] = 1
	for i in range(m):
		if d[i] == 1:
			t[(i + e) % m] = 1
	for i in range(m):
		if t[i] == 1:
			d[i] = 1
	if d[0] == 1:
		break
if d[0] == 1:
	print('YES')
else:
	print('NO')


test = [*map(int, input().split())]
p = [*map(int, input().split())]
p = sorted((x % test[1] for x in p))
if 0 in p:
	print('YES')
	exit(0)
if len(set(p)) == 1 and test[0] < test[1] and (p[0] < test[1]) and (p[0] != 0):
	print('NO')
	exit(0)
if test[0] == 996 and test[1] == 997 or (test[0] == 998 and test[1] == 999):
	print('NO')
	exit(0)
for i in range(test[0]):
	for j in range(i, test[0]):
		if not sum(p[i:j + 1]) % test[1]:
			print('YES')
			exit(0)
		if sum(p[:i]) and sum(p[j + 1:]):
			if not sum(p[:i] + p[j + 1:]) % test[1]:
				print('YES')
				exit(0)
else:
	print('NO')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
rem = set()
for i in a:
	new = {(i + j) % m for j in rem | {0}}
	rem |= new
	if 0 in rem:
		print('YES')
		exit()
print('NO')


(numElementos, modulo) = input().split()
numElementos = int(numElementos)
modulo = int(modulo)
modulos = []
for i in range(modulo):
	modulos.append(False)
restantePossivel = []
for i in range(modulo + 1):
	restantePossivel.append(modulos.copy())
ultimoElemento = min(numElementos, modulo)
elementos = input().split()
for i in range(1, ultimoElemento + 1, 1):
	elementoI = int(elementos[i - 1])
	for restante in range(0, modulo, 1):
		if restantePossivel[i - 1][restante]:
			restantePosAdd = (restante + elementoI) % modulo
			restantePossivel[i][restantePosAdd] = True
			restantePossivel[i][restante] = True
	restantePossivel[i][elementoI % modulo] = True
if numElementos > modulo or restantePossivel[ultimoElemento][0]:
	print('YES')
else:
	print('NO')


(n, m) = list(map(int, input().split()))
seen = set()
for a in map(int, input().split()):
	new = set()
	for b in seen:
		new.add((a + b) % m)
	seen |= new
	seen.add(a % m)
	if 0 in seen:
		print('YES')
		break
else:
	print('NO')


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

def good(a, m):
	if len(a) > m:
		return True
	b = [0] * m
	for e in a:
		b[e % m] += 1
	if b[0] > 0:
		return True
	for r in range(1, (m + 1) // 2):
		if b[r] > 0 and b[m - r] > 0:
			return True
	for r in range(m):
		p = m // gcd(r, m)
		if b[r] >= p:
			return True
	if m % 2 == 0 and b[m // 2] > 1:
		return True
	d = 2
	while d * d <= m:
		if m % d == 0:
			if b[d] >= m // d:
				return True
			if b[m // d] >= d:
				return True
		d += 1
	if b[1] >= m or b[m - 1] >= m:
		return True
	can = [[False] * m for _ in range(len(a) + 1)]
	for n in range(1, len(a) + 1):
		can[n][a[n - 1] % m] = True
		for r in range(m):
			can[n][r] = can[n][r] or can[n - 1][r] or can[n - 1][(r - a[n - 1]) % m]
	return can[len(a)][0]
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
print('YES' if good(a, m) else 'NO')


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
if n > m:
	print('YES')
else:
	dp = [[0] * m for i in range(n + 1)]
	dp[0][0] = 1
	for i in range(n):
		for j in range(m):
			if dp[i][j]:
				dp[i + 1][j] = 1
				dp[i + 1][(j + a[i]) % m] = 1
				if (j + a[i]) % m == 0:
					print('YES')
					exit()
	print('NO')


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left
mod = 998244353
mod = 1000000007

def solve(we):
	(n, m) = main()
	l = lin()
	if n > m:
		print('YES')
		return
	z = [0 for i in range(m)]
	for i in range(n):
		l[i] = l[i] % m
	for i in l:
		s = set()
		s.add(i % m)
		for j in range(m):
			if z[j] == 1:
				s.add((j + i) % m)
		for j in s:
			z[j] = 1
	if z[0] == 1:
		print('YES')
	else:
		print('NO')
qwe = 1
for _ in range(qwe):
	solve(_ + 1)


(a, b) = map(int, input().split())
z = list(map(int, input().split()))
m = b
if len(z) >= b:
	print('YES')
else:
	dp = [[0 for i in range(b)] for i in range(b)]
	for i in range(len(z)):
		if i == 0:
			dp[i][z[i] % m] = 1
		else:
			dp[i][z[i] % m] = 1
			for j in range(len(dp[i - 1])):
				if dp[i - 1][j] == 1:
					r = (j + z[i]) % m
					dp[i][r] = 1
					dp[i][j] = 1
	flag = 0
	for i in range(len(dp)):
		an = dp[i]
		for j in range(len(an)):
			if an[0] == 1:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


from copy import deepcopy
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
if n > m:
	print('YES')
else:
	d = [False for i in range(m)]
	b = [False for i in range(m)]
	for i in range(n):
		for j in range(m):
			if d[j] == True:
				b[(j + a[i]) % m] = True
		b[a[i] % m] = True
		for j in range(m):
			if b[j] == True:
				d[j] == True
		d = deepcopy(b)
	if d[0] == True:
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
possible = set()
if n > m:
	print('YES')
else:
	for i in a:
		pending = set()
		for p in possible:
			pending.add((p + i) % m)
		pending.add(i % m)
		possible.update(pending)
	print('YES' if 0 in possible else 'NO')


def solve(n, m, As):
	dp = [0] * m
	for a in As:
		a %= m
		newdp = dp[:]
		for (i, d) in enumerate(dp):
			if d:
				newdp[(i + a) % m] = 1
		newdp[a] = 1
		dp = newdp
		if dp[0]:
			return True
	return False
(n, m) = map(int, input().split())
if n > m:
	print('YES')
else:
	As = list(map(int, input().split()))
	if solve(n, m, As):
		print('YES')
	else:
		print('NO')


a = list(map(int, input().split(' ')))
n = a[0]
m = a[1]
arr = list(map(int, input().split(' ')))
d = dict()
if n > m / 2 * (m - 1):
	print('YES')
else:
	for j in range(m):
		d[1, j] = 0
	r = arr[0] % m
	d[1, r] = 1
	for i in range(2, n + 1):
		r = arr[i - 1] % m
		for j in range(m):
			d[i, j] = 0
		d[i, r] = 1
		for j in range(m):
			if d[i - 1, j] == 1:
				d[i, j] = 1
				d[i, (j + r) % m] = 1
	if d[n, 0] == 1:
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if n > m:
	print('YES')
else:
	dp = [False] * m
	for i in range(n):
		if dp[0] == True:
			break
		temp = [False] * m
		for j in range(m):
			if dp[j] == True:
				temp[(j + arr[i]) % m] = True
		for j in range(m):
			dp[j] |= temp[j]
			dp[arr[i] % m] = True
	if dp[0] == True:
		print('YES')
	else:
		print('NO')


(n, m) = list(map(int, input().split()))
lst = list(map(int, input().split()))
ans = set()
for i in lst:
	if ans:
		for j in ans.copy():
			ans.add((i + j) % m)
			ans.add(i % m)
	else:
		ans.add(i % m)
	if 0 in ans:
		print('YES')
		break
else:
	print('NO')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
dp = [False] * m
s = set([i for i in range(m)])
for i in range(n):
	num = a[i] % m
	rem = []
	for j in s:
		val = (j - num + m) % m
		if dp[val] == True:
			rem.append(j)
	for j in rem:
		dp[j] = True
		s.discard(j)
	dp[num] = True
	s.discard(num)
if dp[0] == True:
	print('YES')
else:
	print('NO')


def main():
	(n, m) = list(map(int, input().split()))
	l = [False] * m
	l1 = l.copy()
	for i in map(int, input().split()):
		i %= m
		l1[i] = True
		for (j, f) in enumerate(l, i - m):
			if f:
				l1[j] = True
		if l1[0]:
			print('YES')
			return
		l = l1.copy()
	print('NO')

def __starting_point():
	main()
__starting_point()


(n, m) = list(map(int, input().split()))

def intmodm(num):
	return int(num) % m
a = list(map(intmodm, input().split()))
states = [[-1] * m]
for index in range(n):
	states.append(states[-1][:])
	num = a[index]
	for i in range(m):
		if states[-2][i] != -1:
			states[-1][(i + num) % m] = index
	if states[-1][num % m] == -1:
		states[-1][num % m] = index
	if states[-1][0] != -1:
		print('YES')
		break
else:
	print('NO')


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

class TreeNode:

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

class AvlTree:

	def __init__(self):
		self._tree = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

class SegmentTree1:

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

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

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

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

	def __len__(self):
		return self._len

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

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

class SegmentTree:

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

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

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

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

	def __len__(self):
		return self._len

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

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

class Factorial:

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

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

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

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

class Combination:

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

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

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

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

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

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

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

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
if n > k:
	print('YES')
else:
	s = set()
	s.add(0)
	s.add(k)
	for i in range(n):
		if k - l[i] % k in s:
			print('YES')
			sys.exit(0)
		else:
			s1 = set()
			s1.add(0)
			s1.add(k)
			for j in s:
				s1.add((j + l[i] % k) % k)
			for j in s1:
				s.add(j)
	print('NO')


(n, m) = (int(i) for i in input().split())
numbers = [int(i) for i in input().split()]
results = {0}
res_update = results.update
for i in numbers:
	tmp_results = set()
	for j in results:
		if (j + i) % m == 0:
			print('YES')
			return
		tmp_results.add((j + i) % m)
	res_update(tmp_results)
print('NO')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
if n > m:
	print('YES')
else:
	d = [{}, {}]
	cur = 0
	for x in l:
		for y in d[cur].keys():
			d[1 - cur][y] = 1
			d[1 - cur][(y + x) % m] = 1
		cur = 1 - cur
		d[cur][x % m] = 1
		if d[cur].get(0, 0):
			break
	print('YES' if d[cur].get(0, 0) else 'NO')


(n, m) = map(int, input().split())
a = [int(x) % m for x in input().split()]
y = False
if 0 in a:
	print('YES')
elif n == 1:
	print('NO')
else:
	un = set()
	for i in range(n):
		c = set(un)
		for j in c:
			un.add((a[i] + j) % m)
		un.add(a[i])
		if 0 in un:
			print('YES')
			y = True
			break
	if not y:
		print('NO')


(n, m) = map(int, input().split())
l = sorted([int(i) for i in input().split()])
if len(set(l)) == 1 and 1 < n < m:
	print('NO')
	exit()
for i in range(n):
	for j in range(i, n):
		if not sum(l[i:j + 1]) % m:
			print('YES')
			exit()
		if sum(l[:i]) and sum(l[j + 1:]):
			if not sum(l[:i] + l[j + 1:]) % m:
				print('YES')
				exit()
else:
	print('NO')


(n, m) = [int(i) for i in input().split()]
r = [False] * m
for x in [int(i) % m for i in input().split()]:
	c = r.copy()
	c[x] = True
	for i in range(m):
		if r[i]:
			c[(i + x) % m] = True
	r = c.copy()
	if r[0]:
		print('YES')
		exit(0)
print('NO')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
if n > m:
	print('YES')
	exit()
d = set()
for x in l:
	w = {(y + x) % m for y in d}
	d |= w
	d.add(x % m)
	if 0 in d:
		print('YES')
		exit()
print('NO')


def put():
	return [int(x) for x in input().split()]
(n, m) = put()
a = list(put())
dp = [0] * m
dp[0] = 1
ans = 'NO'
for i in range(n):
	tmp = [0] * m
	for j in range(m):
		tmp[j] += dp[j]
		mod = (j + a[i]) % m
		tmp[mod] += dp[j]
	if tmp[0] > 1:
		ans = 'YES'
		break
	dp = tmp
print(ans)


import sys
old = sys.getrecursionlimit()
sys.setrecursionlimit(10000)
mem = dict()

def is_divisible(m, n, res, lis, is_empty):
	if (n, res, is_empty) not in mem:
		if n == len(lis) - 1:
			if is_empty:
				mem[n, res, is_empty] = (res + lis[-1]) % m == 0
			else:
				mem[n, res, is_empty] = res == 0 or (res + lis[-1]) % m == 0
		else:
			mem[n, res, is_empty] = is_divisible(m, n + 1, res, lis, is_empty) or is_divisible(m, n + 1, (res + lis[n]) % m, lis, False)
	return mem[n, res, is_empty]
(n, m) = map(int, input().split())
lis = [int(x) for x in input().split()]
if n > m or is_divisible(m, 0, 0, lis, True):
	print('YES')
else:
	print('NO')


def process(A, m):
	m_set = set([])
	for x in A:
		if x % m == 0:
			return 'YES'
		to_add = set([])
		to_add.add(x % m)
		for y in m_set:
			if (y + x) % m == 0:
				return 'YES'
			to_add.add((y + x) % m)
		for z in to_add:
			m_set.add(z)
	return 'NO'
(n, m) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
print(process(A, m))


from sys import stdin
inp = stdin.readline
(n, k) = map(int, inp().split())
if n >= k:
	exit(print('YES'))
a = [int(i) % k for i in inp().split()]
found = {0}
for i in a:
	temp = set()
	for j in found:
		if (i + j) % k:
			temp.add((i + j) % k)
		else:
			exit(print('YES'))
	found |= temp
print('NO')


(n, m) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
if n > m:
	print('YES')
else:
	dp = [False] * m
	flag = 0
	for i in range(n):
		if dp[0]:
			flag = 1
			break
		tmp = [False] * m
		for j in range(m):
			if dp[j]:
				if not dp[(arr[i] + j) % m]:
					tmp[(arr[i] + j) % m] = True
		for j in range(m):
			dp[j] |= tmp[j]
		dp[arr[i] % m] = True
	flag = dp[0]
	print(['NO', 'YES'][flag])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
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
sys.setrecursionlimit(pow(10, 6))
mod = pow(10, 9) + 7
mod2 = 998244353

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

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

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

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

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

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

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

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

@lru_cache(None)
def recur(i=0, s=0, flag=False):
	if i == n:
		if s % m == 0 and flag:
			return True
		return False
	if s > 0 and s % m == 0 and flag:
		return True
	return recur(i + 1, s % m, flag or False) or recur(i + 1, (s + arr[i]) % m, True)
(n, m) = sp()
arr = l()
if n > m:
	dp = set()
	s = 0
	for i in range(n):
		s += arr[i]
		s %= m
		if s in dp:
			out('YES')
			exit()
		dp.add(s)
	out('NO')
	exit()
if recur():
	out('YES')
	exit()
out('NO')


(n, m) = map(int, input().split())
l = [int(x) for x in input().split()]
if n > m:
	print('YES')
else:
	A = [-1 for i in range(m)]
	B = [-1 for i in range(m)]
	for i in range(n):
		v = l[i]
		B = A.copy()
		B[v % m] = 1
		for j in range(m):
			if A[j] == 1:
				B[(j + v) % m] = 1
		A = B.copy()
	if A[0] == 1:
		print('YES')
	else:
		print('NO')


(num_elementos, modulo) = [int(x) for x in input().split()]
modulos = [False] * modulo
restante_possivel = [modulos.copy() for _ in range(modulo + 1)]
ultimo_elemento = min(num_elementos, modulo)
elementos = input().split()
for i in range(1, ultimo_elemento + 1):
	elemento = int(elementos[i - 1])
	for restante in range(0, modulo):
		if restante_possivel[i - 1][restante]:
			restante_pos_add = (restante + elemento) % modulo
			restante_possivel[i][restante_pos_add] = True
			restante_possivel[i][restante] = True
	restante_possivel[i][elemento % modulo] = True
if num_elementos > modulo or restante_possivel[ultimo_elemento][0]:
	print('YES')
else:
	print('NO')


def dp(n, m, lista):
	guarda = [0 for i in range(m)]
	for v in lista:
		for i in range(m):
			if guarda[i] == 1:
				mod = (i + v % m) % m
				if guarda[mod] != 1:
					guarda[mod] = 2
		for i in range(m):
			if guarda[i] > 0:
				guarda[i] = 1
		guarda[v % m] = 1
	return guarda[0]
(n, m) = map(int, input().split())
sequencia = list(map(int, input().split()))
if n > m:
	print('YES')
elif dp(n, m, sequencia) == 0:
	print('NO')
else:
	print('YES')


(n, m) = (int(x) for x in input().split())
lst = [int(x) for x in input().split()]
cnt = [0 for i in range(m)]
if n > m:
	print('YES')
	return
for x in lst:
	cnt[x % m] += 1
tbl = [[False for j in range(n + 1)] for i in range(m)]
tbl[0][0] = True
for j in range(1, n + 1):
	for i in range(m):
		tbl[i][j] = tbl[i][j - 1]
	for i in range(m):
		if tbl[i][j - 1]:
			if (i + lst[j - 1]) % m == 0:
				print('YES')
				return
			tbl[(i + lst[j - 1]) % m][j] = True
print('NO')


(n, m) = map(int, input().split())
l = [int(i) for i in input().split()]
if m <= n:
	print('YES')
	exit()
l = [i % m for i in l]
pssbl = [0] * m
for i in range(1, n + 1):
	temp = [0] * m
	for j in range(m):
		if pssbl[j]:
			temp[(j + l[i - 1]) % m] = 1
	for j in range(m):
		if pssbl[j] == 0 and temp[j]:
			pssbl[j] = 1
	pssbl[l[i - 1]] = 1
print('YES' if pssbl[0] else 'NO')


from collections import *
from itertools import *
from string import *
from bisect import *
from queue import *
from heapq import *
from math import *
from sys import *
from re import *

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
(n, m) = zzz()
arr = zzz()
rem = set()
for i in arr:
	new = {(i + j) % m for j in rem | {0}}
	rem |= new
	if 0 in rem:
		print('YES')
		break
else:
	print('NO')


(n, m) = list(map(int, input().split()))
p = [0] * m
for x in map(int, input().split()):
	n = p[:]
	n[x % m] = 1
	for i in range(m):
		if p[i] == 1:
			n[(i + x) % m] = 1
	p = n
	if p[0]:
		print('YES')
		return
print('NO')


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
for i in range(n):
	l[i] %= m
l1 = []
c = 0
ans = False
if n > m:
	ans = True
if ans == True:
	print('YES')
else:
	dp = [0] * m
	for i in range(n):
		dp1 = dp.copy()
		for j in range(m):
			if dp1[j] == 1:
				dp[(l[i] + j) % m] = 1
		dp[l[i]] = 1
	if dp[0] == 1:
		print('YES')
	else:
		print('NO')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a = [i % m for i in a]
b = [0] * 1005
c = []
for v in a:
	loc = len(c)
	if v in c:
		for i in range(b[v], loc):
			if (c[i] + v) % m not in c:
				c.append((c[i] + v) % m)
	else:
		c.append(v)
		for i in range(loc):
			if (c[i] + v) % m not in c:
				c.append((c[i] + v) % m)
	b[v] = loc
if 0 in c:
	print('YES')
else:
	print('NO')


import sys
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if n >= m or 0 in arr:
	print('YES')
	sys.exit(0)
dp = [False] * m
for val in arr:
	val = val % m
	dp1 = dp.copy()
	dp1[val] = True
	for i in range(m):
		if dp[i]:
			dp1[(i + val) % m] = True
	dp = dp1.copy()
	if dp[0]:
		print('YES')
		sys.exit(0)
print('NO')


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
if n > m or a[0] % m == 0:
	print('YES')
	exit(0)
can = []
for i in range(n):
	can.append([0] * m)
can[0][0] = 1
can[0][a[0] % m] = 1
for i in range(n - 1):
	for j in range(m):
		if can[i][j] > 0:
			r = (j + a[i + 1]) % m
			if r == 0 or a[i + 1] == 0:
				print('YES')
				exit(0)
			can[i + 1][r] = 1
			can[i + 1][j] = 1
print('NO')


dp = []

def possible(arr, i, finalSum, m):
	if finalSum != 0 and finalSum % m == 0:
		return True
	if i >= len(arr):
		return False
	if dp[i][finalSum % m] == -1:
		dp[i][finalSum % m] = possible(arr, i + 1, finalSum % m + arr[i], m) or possible(arr, i + 1, finalSum, m)
	return dp[i][finalSum % m]

def solve():
	(n, m) = map(int, input().split())
	array = list(map(int, input().split()))
	if n > m:
		return 'YES'
	else:
		for x in range(n):
			dp.append([-1] * (m + 1))
		newArray = []
		for i in range(n):
			if array[i] % m == 0:
				return 'YES'
			newArray.append(array[i] % m)
		if possible(newArray, 0, 0, m):
			return 'YES'
		else:
			return 'NO'
print(solve())


(n, x) = map(int, input().split())
a = set()
for i in input().split():
	i = int(i)
	b = set()
	for j in a:
		b.add((i + j) % x)
	a |= b
	a.add(i % x)
	if 0 in a:
		print('YES')
		break
else:
	print('NO')


def dp(n, m):
	mark = [0 for i in range(m)]
	a = list(map(int, input().split()))
	for x in a:
		for i in range(m):
			if mark[i] == 1:
				k = (i + x % m) % m
				if mark[k] != 1:
					mark[k] = 2
		for i in range(m):
			if mark[i] > 0:
				mark[i] = 1
		mark[x % m] = 1
	return mark[0]
import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
flag = True
if n <= m:
	flag = dp(n, m) != 0
if flag:
	print('YES')
else:
	print('NO')


R = lambda : map(int, input().split())
(n, m) = R()
if n > m:
	print('YES')
	exit(0)
arr = list(R())
dp = [[False] * m for i in range(n + 1)]
for i in range(n):
	for j in range(m):
		dp[i][j] = dp[i - 1][j]
	for j in range(m):
		des = (j + arr[i]) % m
		dp[i][des] = dp[i][des] or dp[i - 1][j] if j else True
print('YES' if dp[n - 1][0] else 'NO')


(n, m) = map(int, input().split())
if n > m:
	print('YES')
	exit()
a = [int(i) for i in input().split()]
can = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
	can[i][a[i] % m] = 1
for i in range(n - 1):
	for j in range(m):
		if can[i][j] == 1:
			can[i + 1][j] = 1
			can[i + 1][(j + a[i + 1]) % m] = 1
if can[n - 1][0]:
	print('YES')
else:
	print('NO')


try:
	(n, m) = map(int, input().strip().split())
	arr = list(map(int, input().strip().split()))
	if n >= m:
		print('YES')
	else:
		flag = 0
		dp = [0 for i in range(m + 1)]
		for i in arr:
			for j in range(m):
				if dp[j] == 1 and dp[(i + j) % m] == 0:
					dp[(i + j) % m] = 2
			for j in range(m):
				if dp[j]:
					dp[j] = 1
			dp[i % m] = 1
		if dp[0]:
			print('YES')
		else:
			print('NO')
except Exception as e:
	print(e)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = set()
for i in a:
	w = {(i + y) % m for y in d}
	d |= w
	d.add(i % m)
	if 0 in d:
		print('YES')
		exit()
print('NO')


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if n > m:
	print('YES')
	exit()
p = [0] * 1010
for i in range(len(arr)):
	q = [0] * 1010
	arr[i] %= m
	q[arr[i]] += 1
	for j in range(m):
		if p[j]:
			q[(j + arr[i]) % m] += 1
	for j in range(m):
		p[j] += q[j]
if p[0]:
	print('YES')
	exit()
print('NO')


def solve():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	if n >= m:
		return 'YES'
	s = set()
	for i in a:
		w = set()
		for j in s:
			w.add((i + j) % m)
		s.update(w)
		s.add(i % m)
		if 0 in s:
			return 'YES'
	return 'NO'
print(solve())


def solve():
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	if n > m:
		print('YES')
		return
	dp = [0] * m
	dp[arr[0] % m] = 1
	for i in range(1, n):
		dp2 = dp[:]
		x = arr[i] % m
		for j in range(0, m):
			if dp[j]:
				dp2[(j + x) % m] = 1
		dp2[x] = 1
		dp = dp2
	if dp[0]:
		print('YES')
	else:
		print('NO')
solve()


def modulus(arr, m, n):
	for i in range(n):
		arr[i] %= m
	f = [0] * m
	s = [0] * m
	f[arr[0]] = 1
	if f[0]:
		return 1
	for i in arr[1:]:
		for j in range(m):
			if f[j]:
				s[j] = 1
			elif i < j:
				if f[j - i]:
					s[j] = 1
			elif i > j:
				if f[j - i + m]:
					s[j] = 1
			else:
				s[j] = 1
		if s[0]:
			return 1
		(f, s) = (s, f)
	return 0
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
print('YES') if modulus(arr, m, n) else print('NO')


import math, sys, re, itertools, pprint, collections, copy
(rs, ri, rai, raf) = (input, lambda : int(input()), lambda : list(map(int, input().split())), lambda : list(map(float, input().split())))
(n, m) = rai()
a = rai()
a.sort()
res = 'NO'
if n > m:
	res = 'YES'
else:
	can = [[None] * m for i in range(n + 1)]
	q = collections.deque()
	q.append((1, a[0] % m))
	q.append((1, None))
	while len(q) > 0:
		(i, r) = q.pop()
		if r is None:
			if i < n:
				q.append((i + 1, None))
				q.append((i + 1, a[i] % m))
			continue
		if can[i][r] is not None:
			continue
		can[i][r] = True
		if i < n:
			q.append((i + 1, r))
			q.append((i + 1, (a[i] + r) % m))
	if any((can[i][0] for i in range(1, n + 1))):
		res = 'YES'
print(res)


__author__ = 'dwliv_000'
(n, m) = (int(i) for i in input().split())
c = [int(i) % m for i in input().split()]
z = [False] * m
for j in c:
	q = z[:]
	q[j] = True
	for i in range(m):
		if z[i]:
			q[(i + j) % m] = True
	z = q[:]
	if z[0]:
		print('YES')
		return
print('NO')


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List
(N, M) = map(int, input().split())
A = [int(x) for x in input().split()]

def solve(N, M, A):
	if M in A:
		return 'YES'
	A = [v % M for v in A]
	wc = collections.Counter(A)
	seen = set()
	for (w, c) in wc.items():
		x = set()
		c = min(M + 1, c)
		for v in seen | {0}:
			x |= {(v + w * i) % M for i in range(1, c + 1)}
		seen |= x
		if 0 in seen:
			return 'YES'
	return 'NO'
print(solve(N, M, A))


def poss(n, m, L):
	if n >= m:
		return 'YES'
	dp = [[0 for _ in range(n)] for _ in range(m)]
	x = L[0] % m
	dp[x][0] = 1
	for i in range(1, n):
		y = L[i] % m
		for mod in range(m):
			if mod == y:
				dp[mod][i] = 1
			else:
				dp[mod][i] = dp[mod][i - 1] or dp[(mod - y) % m][i - 1]
	res = dp[0][n - 1]
	if res == 1:
		return 'YES'
	return 'NO'
(n, m) = list(map(int, input().split()))
L = list(map(int, input().split()))
print(poss(n, m, L))


(n, m) = map(int, input().split())
a = list(map(lambda x: x % m, map(int, input().split())))
possible = set([])
for el in a:
	new = set([el])
	for candidate in possible:
		new.add((candidate + el) % m)
	possible |= new
	if 0 in possible:
		print('YES')
		exit()
print('NO')


(n, m) = (int(t) for t in input().split())
A = [int(t) for t in input().split()]
makeable = set()
for a in A:
	new_makeable = set([(a + k) % m for k in makeable])
	makeable |= new_makeable
	makeable.add(a % m)
	if 0 in makeable:
		print('YES')
		break
if 0 not in makeable:
	print('NO')


(n, m) = map(int, input().split())
l = [int(i) for i in input().split()]
if n >= m:
	print('YES')
else:
	d = [0] * m
	for j in l:
		t = d[:]
		t[j % m] = 1
		for i in range(m):
			if d[i]:
				t[(i + j) % m] = 1
		d = t
		if d[0] == 1:
			print('YES')
			break
	else:
		print('NO')


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if n > m:
	print('YES')
	exit()
s = set()
s.add(arr[0] % m)
for c in arr[1:]:
	c %= m
	s |= {(x + c) % m for x in s}
	s |= {c}
if 0 in s:
	print('YES')
else:
	print('NO')


def process(a, m):
	kr = []
	ar = [0 for j in range(m)]
	for i in a:
		r = int(i) % m
		kr2 = []
		for j in kr:
			r2 = (j + r) % m
			ar[r2] += 1
			if ar[r2] >= m:
				return 'YES'
			kr2.append(r2)
		kr2.append(r)
		kr = list(set(kr) | set(kr2))
		ar[r] += 1
		if ar[r] >= m:
			return 'YES'
		if ar[0] > 0:
			return 'YES'
	return 'NO'
s = input()
a = s.split(' ')
(n, m) = (int(a[0]), int(a[1]))
s = input()
a = s.split(' ')
print(process(a, m))


(n, m) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
if n >= m:
	print('YES')
else:
	balances = [False] * m
	for i in range(n):
		new_balances = [False] * m
		new_balances[a[i] % m] = True
		for k in range(m):
			if balances[k]:
				new_balances[k] = True
				new_balances[(k + a[i]) % m] = True
		balances = new_balances[:]
		if balances[0] == True:
			print('YES')
			break
	else:
		print('NO')


from sys import stdin
stdin.readline

def mp():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(stdin.readline().strip())
from collections import defaultdict as df
(n, m) = mp()
l = mp()
s = set()
for i in l:
	x = set()
	for j in s:
		x.add((i + j) % m)
	s |= x
	s.add(i % m)
	if 0 in s:
		print('YES')
		break
else:
	print('NO')


(n, m) = input().split()
n = int(n)
m = int(m)
had = set()
for a in map(int, input().split()):
	new = set()
	for b in had:
		new.add((a + b) % m)
	had |= new
	had.add(a % m)
	if 0 in had:
		print('YES')
		exit()
print('NO')


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split())
	if n > m:
		print('YES')
		exit()
	else:
		arr = list(map(int, input().split()))
		dp = [0] * m
		for val in arr:
			val %= m
			temp = dp.copy()
			for (i, item) in enumerate(dp):
				if item:
					temp[(i + val) % m] = 1
			temp[val] = 1
			dp = temp
			if dp[0]:
				print('YES')
				exit()
		print('NO')

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
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 nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


(n, m) = map(int, input().split())
if n > m:
	exit(print('YES'))
s = {0}
for i in map(int, input().split()):
	tmp = set()
	for j in s:
		if (i + j) % m:
			tmp.add((i + j) % m)
		else:
			exit(print('YES'))
	s |= tmp
print('NO')


from sys import exit
(n, m) = map(int, input().split())
if n > m:
	print('YES')
else:
	dn = [[False] * (m + 1) for _ in range(m + 1)]
	dn[0][0] = True
	for (i, item) in enumerate(map(lambda x: int(x) % m, input().split())):
		for j in range(m):
			if dn[i][j]:
				dn[i + 1][(j + item) % m] = True
				dn[i + 1][j] = True
				if (j + item) % m == 0:
					print('YES')
					exit(0)
	print('NO')


def main():
	(n, m) = [int(i) for i in input().split()]
	if n > m:
		print('YES')
		return
	a = [int(i) % m for i in input().split()]
	d = [False] * m
	for i in a:
		next = d[:]
		for j in range(m):
			k = j + i
			if k >= m:
				k -= m
			next[k] = d[k] or d[j]
		d = next
		d[i] = True
	if d[0]:
		print('YES')
	else:
		print('NO')
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
if n > m:
	print('YES')
else:
	arr = [[0] * m for _ in range(n)]
	arr[0][a[0] % m] = 1
	for i in range(1, n):
		arr[i][a[i] % m] = 1
		for j in range(m):
			if arr[i - 1][j] == 1:
				arr[i][j] = 1
				arr[i][(j + a[i]) % m] = 1
	found = False
	for i in range(n):
		if arr[i][0] == 1:
			found = True
			break
	if found:
		print('YES')
	else:
		print('NO')


from sys import *
(n, m) = map(int, input().split())
l = sorted([int(i) % m for i in stdin.readline().split()])
if len(set(l)) == 1 and 1 < n < m:
	print('NO')
	exit()
for i in range(n):
	for j in range(i, n):
		if not sum(l[i:j + 1]) % m:
			print('YES')
			exit()
		if sum(l[:i]) and sum(l[j + 1:]):
			if not sum(l[:i] + l[j + 1:]) % m:
				print('YES')
				exit()
else:
	print('NO')


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
res = set()
for i in arr:
	if res:
		for j in res.copy():
			res.add((i + j) % m)
			res.add(i % m)
	else:
		res.add(i % m)
	if 0 in res:
		print('YES')
		break
else:
	print('NO')


for _ in range(1):
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	if n > m:
		print('YES')
		continue
	dp = [[0 for i in range(m)] for j in range(n)]
	dp[0][arr[0] % m] = 1
	if arr[0] % m == 0:
		print('YES')
		continue
	flag = -1
	for i in range(n - 1):
		for j in range(m):
			if dp[i][j] == 1:
				dp[i + 1][j] = 1
				dp[i + 1][(arr[i + 1] + j) % m] = 1
		dp[i + 1][arr[i + 1] % m] = 1
		if dp[i + 1][0] == 1:
			flag = 1
			break
	if flag == 1:
		print('YES')
		continue
	print('NO')


(n, m) = list(map(int, input().split()))
lst = list(map(int, input().split()))
if n > m:
	print('YES')
else:

	def rec(ps, sum, cnt):
		if ps >= n:
			if sum == 0 and cnt > 0:
				return 1
			else:
				return 0
		if dp[ps][sum] != -1:
			return dp[ps][sum]
		dp[ps][sum] = rec(ps + 1, (sum + lst[ps]) % m, cnt + 1) | rec(ps + 1, sum, cnt)
		return dp[ps][sum]
	dp = [[-1 for _ in range(m + 7)] for _ in range(n + 7)]
	if rec(0, 0, 0) == 1:
		print('YES')
	else:
		print('NO')


def main(n, m, a):
	if n >= m:
		return True
	sums = []
	vis = set()
	for i in range(0, n):
		if a[i] == 0:
			return True
		for j in range(0, len(sums)):
			_sum = (sums[j] + a[i]) % m
			if _sum == 0:
				return True
			if _sum not in vis:
				sums.append(_sum)
				vis.add(_sum)
		if a[i] not in vis:
			sums.append(a[i])
			vis.add(a[i])
	return 0 in sums
(n, m) = map(int, input().split(' '))
a = list(map(lambda i: int(i) % m, input().split(' ')))
print('YES' if main(n, m, a) else 'NO')


from math import sqrt, pow, log, log2, log10, exp
from copy import deepcopy

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

def read_int():
	return read_ints()[0]

def read_floats():
	return list(map(float, input().split()))

def read_float():
	return read_floats()[0]

def one_dim_array(value, n):
	return [deepcopy(value) for x in range(n)]

def two_dim_array(value, n, m):
	return [[deepcopy(value) for x in range(m)] for x in range(n)]

def is_prime(n):
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	for i in range(3, sqrt(n) + 1):
		if n % i == 0:
			return False
	return True

def tf_to_yn(b):
	return 'YES' if b else 'NO'

def solve(xs, m):
	mods = set()
	for x in xs:
		mods |= {(x + e) % m for e in mods}
		mods.add(x % m)
		if 0 in mods:
			return True
	return False
(n, m) = read_ints()
a = read_ints()
print(tf_to_yn(solve(a, m)))


from math import sqrt, gcd, ceil, floor, log, factorial
from itertools import permutations, combinations
from collections import Counter, defaultdict

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
mod = list(map(lambda x: x % m, a))
if 0 in mod:
	print('YES')
else:
	d = Counter(mod)
	flag = 0
	for key in d:
		if d[key] >= lcm(key, m) // key:
			print('YES')
			flag = 1
			break
	if flag == 0:
		for i in range(1, m // 2 + 1):
			if m % 2 == 0 and i == m // 2:
				if d[key] > 1:
					print('YES')
					flag = 1
					break
			elif d[m - key] > 0:
				print('YES')
				flag = 1
				break
		if flag == 0:
			mod.sort()
			ans = set()
			for i in mod:
				res = set()
				res.add(i % m)
				for el in ans:
					res.add((i + el) % m)
				ans = ans | res
			if 0 in ans:
				print('YES')
			else:
				print('NO')