#K92832. Hash Collision Detection

    ID: 38285 Type: Default 1000ms 256MiB

Hash Collision Detection

Hash Collision Detection

This problem requires you to determine whether any two strings in a given list produce the same hash value when processed by a specific hash function. The hash function computes the sum of the ASCII values of the characters in a string and then takes the modulus with a given integer m. In mathematical notation, the hash function is defined as:

$$ H(s) = \left( \sum_{i=1}^{|s|} \text{ord}(s_i) \right) \bmod m $$

If any two strings yield the same hash value, a collision occurs, and you should output YES; otherwise, output NO.

inputFormat

The input is read from stdin and consists of the following:

  • The first line contains two integers n and m where n is the number of strings and m is the modulus value for hashing.
  • The next n lines each contain a single string.

outputFormat

Output to stdout a single line containing either YES if there is a hash collision or NO if there is no collision.

## sample
5 10
hello
world
hola
amigo
hola
YES