Processing math: 100%
Sum of four values - MarisaOJ: Marisa Online Judge

Sum of four values

Time limit: 1000 ms
Memory limit: 256 MB
Given an array A consisting of n elements and an integer x, determine whether there exist four distinct indices i,j,k,p such that Ai+Aj+Ak+Ap=x. ### Input - The first line contains two integers n and x. - The second line contains n integers Ai. ### Output - Print YES if such indices exist, otherwise print NO. ### Constraints - 1≤n≤1000. - 1≤Ai,x≤109. ### Example Input: 81532581323 Output: YES