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: 
n,m=map(int,raw_input().split())

while n!=0 and m!=0:
    ok=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:
                ok=1
                max=tmp
    if ok==1:
        print(max)
    else:
        print("NONE")
    n,m=map(int,raw_input().split())

Python: while(True):
    n,m=map(int,input().split(" "))
    if(n==0):
        break
    things = list(map(int,input().split(" ")))
    _max=0
    for i in range(len(things)):
        for j in range(i+1,len(things)):
            if things[ i]+things[j] <= m:
                _max = max(things[i]+things[j],_max)
    if _max != None:
        print(_max)
    else:
        print("NONE")

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

Python: def main():
  while True:
    n, m = map(int, input().split())
    if n == 0:
      break
  
    items = sorted(list(map(int, input().split())))
    ans = 0
    for i in range(n - 1):
      p1 = items[i]
      for j in range(i + 1, n):
        p2 = p1 + items[j]
        if p2 > m:
          break
        if ans < p2:
          ans = p2
    if ans != 0:
      print(ans)
    else:
      print("NONE")
  
main()

Python: while 1!=0:
    n, m = map(int,input().split())
    if n==0 and m==0:
        break
    lista= [int (i) for i in input().split()]
    ans = 0
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            if (lista[i]+lista[j])<=m and (lista[i]+lista[j])>ans:
                ans = lista[i] + lista[j]
                
    if ans == 0:
        print('NONE')
    else:
        print(ans)

Python: A=[0 for i in range(2)]
A=(int,input().split())
n=A[0]
m=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):
        for j in range(i+1,n):  
            x=0 
            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: from itertools import combinations
while True:
    n, p = [int(x) for x in input().split()]
    if n == 0 and p == 0:
        break
    L = [int(x) for x in input().split()]
    m = -1
    for i, j in combinations(L,2):
        if i+j <=p:
            m = max(m,i+j)
    if m > 0:
        print(m)
    else:
        print("NONE")

Python: while(True):
    n,m=map(int,input().split(" "))
    if(n==0):
        break
    things = set(map(int,input().split(" ")))
    _max=0
    for i in things:
        for j in things:
            if(i!=j and i+j <= m and i+j>_max):
                _max = i+j
    if _max != None:
        print(_max)
    else:
        print("NONE")

Python: while 1:
    n, m = map(int, input().split())
    if n == m == 0:
        break
    *A,=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")

Python: answer=[]
while True:
    t = 0
    n,m = map(int,input().split())
    if n != 0:
        a = list(map(int,input().split()))
        a.sort()
        for i in range(n - 1):
            k = a[-i-1]
            for j in range(n - i - 1):
                if k + a[-i-j-1] <= m:
                    if k + a[-i-j-1] >= t:
                        t = k + a[-i-j-1]
                    break
        if t == 0:
            answer.append("NONE")
        else:
            answer.append(t)
    else:
        break
for i in range(len(answer)):
    print(answer[i])

Python: """
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print(str(a+b+c) + " " + s)
"""


def main():
	while(1):

		N,n = map(int, input().split())
		
		if N == 0 and n == 0:
			break

		a = list(map(int, input().split()))
		ans = 0
		for i in range(N):
			for j in range(i+1,N):
				if a[i]+a[j] <= n and a[i]+a[j] > ans:
					ans = a[i]+a[j]

		if ans == 0:
			print("NONE")
		else:
			print(ans)


if __name__ == '__main__':
    main()

Python: #16D8101014F 久留米 竜之介 2018/5/16 Python3 

Box=[]
Box2=[]
tmp=[]
mon=0
while True:
	Sum=0
	mon=0
	n,m=map(int,input().split())
	if n==0: break
	tmp=input().split()
	#print(tmp)
	for i in range(n):
		Box.append(int(tmp[i]))
	for j in range(n):
		for k in range(n):
			if j is not k:
				mon=Box[j]+Box[k]
			if mon <= m and Sum < mon:
				Sum=mon
	if Sum is not 0:
		Box2.append(Sum)				
	else:
		Box2.append("NONE")
	Box.clear()
	
for i in Box2:
	print(i)

Python: ans = []
cou = 0

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


    for i in range(n-1):
        for j in range(i+1,n):
            if(max_ans < ar[i]+ar[j] and ar[i]+ar[j] <= m):
                max_ans = ar[i] + ar[j]

    ans.append(max_ans)
    cou += 1

for i in range(cou):
    if(ans[i] == 0): print("NONE")
    else: print(ans[i])