Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n, m := io.NextInt(), io.NextInt()
		if n == 0 {
			break
		}
		a := make([]int, n)
		for i := 0; i < n; i++ {
			a[i] = io.NextInt()
		}
		ans := 0
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				if a[i]+a[j] <= m {
					ans = intMax(a[i]+a[j], ans)
				}
			}
		}
		if ans == 0 {
			io.Println("NONE")
		} else {
			io.Println(ans)
		}
	}
}

func intMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: while 1:
    n, m = 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 >= 0:
                yield A[i] + A[j]
    print(max(f()) or"NONE")

Python: max1=[]
ok1=[0]

n,m=map(int,raw_input().split())

while n>0 and m>0:
    tmp=0
    ie=0
    list=map(int,raw_input().split())
    if list[0]<m:
        max=list[0]
    for j in range(len(list)-1):
        for k in range(1,len(list)):
            tmp=list[j]+list[k]
            if tmp>max and tmp<=m:
                max=tmp
                ok1.insert(ie,1)
    max1.insert(ie,max)
    n,m=map(int,raw_input().split())
    ie+=1

for i in range(len(max1)-1,-1,-1):
    if ok1[i]==1:
        print(max1[i])
    else:
        print("NONE")

Python: while True:
    n, m = map(int, input().strip().split())
    if n == 0:
        break
    a = sorted(list(map(int, input().strip().split())))
    ans = 0
    po = n - 1
    for i in range(n):
        while po > i and a[i] + a[po] > m:
            po -= 1
        if po <= i:
            break
        ans = max(ans, a[i] + a[po])
    print(ans if ans > 0 else 'NONE')

Python: C=[0 for i in range(2)]
C=input().split()
n=(int)(C[0])
x=(int)(C[1])

B=[]
cnt=0
while n>0:

	A=[0 for i in range(n)]
	A=input().split()

	max=0

	for i in range(len(A)-1):
		for j in range(i+1, len(A)):
			if max<(int)(A[i])+(int)(A[j]) and (int)(A[i])+(int)(A[j])<=x:
				max=(int)(A[i])+(int)(A[j])
	if max>0:
		B.append(max)
	else:
		B.append("NONE")

	C=[0 for i in range(2)]
	C=input().split()
	n=(int)(C[0])
	x=(int)(C[1])

	cnt+=1

for i in range(cnt):
	print(B[i])

Python: maxs=[]
while(True):
    max=-1
    
    b=list(map(int,input().split()))
    n=b[0]
    m=b[1]
    if(n == 0 and m == 0):
        break
    a=list(map(int,input().split()))
    for i in range(n):
        for j in range(i+1,n):
            sum=a[i]+a[j]
            if(sum>max and sum<m):
                max=sum
    maxs.append(max)

for i in maxs:
    if i==-1:
        print("NONE")
    else:
        print(i)

Python: A=[0 for i in range(2)]
A=input().split()
n=int(A[0])
m=int(A[1])
max=[]
k=0
while n>0 and m>0:
    B=[0 for i in range(n)]
    B=input().split()
    for i in range(n):
        B[i]=int(B[i])
    ma=0
    for i in range(n-1):
        for j in range(i,n):   
            x=B[i]+B[j]
            if ma<x and x<=m:
                ma=x
    max.append(ma)
    A=input().split()
    n=int(A[0])
    m=int(A[1])
    k+=1
for i in range(k):
    if max[i]>0:
        print(max[i])
    else:
        print("NONE")

Python: while True:
    S=[]
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    else:
        a=list(map(int,input().split()))
        a.sort(reverse=True)
        ans="NONE"
        for i in range(n-1):
            for j in range(i+1,n):
                s=a[i]+a[j]
                S.append(s)
        S.sort(reverse=True)
        for k in range (len(S)):
            if S[k]<=m:
                ans=S[k]
                break
            else:
                pass
        print(ans)

Python: while True :
    n, m = map(int, input().split())
    
    if n == 0 :
        break
    
    else :
        A = list(map(int, input().split()))
        s = 0
        
        As = sorted(A)
        
        for i in range(len(As) - 1) :
            for j in range(i + 1, len(As)) :
                if As[i] + As[j] <= m and As[i] + As[j] > s :
                    s = As[i] + As[j]
                    
                elif As[i] + As[j] > m :
                    break
                
        if s == 0 :
            print("NONE")
        else :
            print(s)

Python: from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

while True:
    n,m = inpl()
    if m == 0:
        break
    else:
        aa = inpl()
        aa.sort()
        ans = -1
        for i in range(n):
            x = aa[i]
            for j in range(n):
                y = aa[j]
                if i == j or x+y > m:
                    continue
                ans = max(x+y,ans)
        if ans == -1:
            print('NONE')
        else:
            print(ans)

Python: while True:
    n,m=map(int,input().split())
    if n==m==0:
        break
    cata=list(map(int,input().split()))
    max=0
    sum=0
    for i in range(n):
        for j in range(i+1,n):
            sum=cata[i]+cata[j]
            if sum<=m and sum>max:
                max=sum
    if max==0:
        print('NONE')
    else:
        print(max)

Python: # coding: utf-8
while 1:
    n,m=map(int,input().split())
    if n==0:
        break
    d=list(map(int,input().split()))
    mx=-1
    for i in range(n):
        for j in range(i+1,n):
            if d[i]+d[j]<=m:
                mx=max(d[i]+d[j],mx)
    print(mx if mx!=-1 else 'NONE')

Python: 
s=[]

cnt=0

while 1:
    max=0
    n,m =map(int,input().split())
    if n==0 and m==0:
        break
    l=list(map(int,input().split()))


    for i in range(len(l)):
        for j in range(len(l)):
            if max<l[i]+l[j] and i!=j and m>=l[i]+l[j]:
                max=l[i]+l[j]

    if max==0:
        s+=["NONE"]
    else:
        s+=[max]


for x in s:
    print(x)