while 1:

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

    if n == m == 0:

        break

    *A,=list(map(int, input().split()))

    s=0

    for i in range(n):

        for j in range(i):

            if s<A[i]+A[j]<=m:

                s = A[i]+A[j]

    print((s or"NONE"))
while 1:

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

    if n == m == 0:

        break

    A=sorted(map(int, input().split()))

    def f():

        j = n-1

        yield 0

        for i in range(n):

            while j >= 0 and m < A[i]+A[j]:

                j -= 1

            if j <= i:

                break

            if j >= 0:

                yield A[i]+A[j]

    print((max(f()) or"NONE"))
while 1:
    n, m = list(map(int, input().split()))
    if n == m == 0:
        break
    (*A,) = list(map(int, input().split()))
    s = 0
    for i in range(n):
        for j in range(i):
            if s < A[i] + A[j] <= m:
                s = A[i] + A[j]
    print((s or "NONE"))

while 1:
    n, m = list(map(int, input().split()))
    if n == m == 0:
        break
    A = sorted(map(int, input().split()))

    def f():
        j = n - 1
        yield 0
        for i in range(n):
            while j >= 0 and m < A[i] + A[j]:
                j -= 1
            if j <= i:
                break
            if j >= 0:
                yield A[i] + A[j]

    print((max(f()) or "NONE"))

-    (*A,) = list(map(int, input().split())) -    s = 0 -    for i in range(n): -        for j in range(i): -            if s < A[i] + A[j] <= m: -                s = A[i] + A[j] -    print((s or "NONE")) +    A = sorted(map(int, input().split())) + +    def f(): +        j = n - 1 +        yield 0 +        for i in range(n): +            while j >= 0 and m < A[i] + A[j]: +                j -= 1 +            if j <= i: +                break +            if j >= 0: +                yield A[i] + A[j] + +    print((max(f()) or "NONE"))